– 3.1.1 Create a database named school and a table named student
CREATE DATABASE IF NOT EXISTS School;
USE School;
CREATE TABLE IF NOT EXISTS Student (
Student_ID INT,
Student_Name VARCHAR(255),
Student_Surname VARCHAR(255),
Student_Phone VARCHAR(20),
Student_Address VARCHAR(255),
PRIMARY KEY (Student_ID)
);
– 3.1.2 Insert all the records shown on the table above
INSERT INTO Student (Student_ID, Student_Name, Student_Surname, Student_Phone, Student_Address)
VALUES
(1234, ‘Erling’, ‘Sule’, ‘0711234567’, ‘332 1st Avenue’),
(5678, ‘Cristiano’, ‘Ronaldo’, ‘0724567890’, ‘1 82nd Street’),
(9101, ‘Abedi’, ‘Pele’, ‘0737894560’, ‘8 Fauna Drive’);
– 3.1.3 Insert a new record with the Student_ID 9999
INSERT INTO Student (Student_ID, Student_Name, Student_Surname, Student_Phone, Student_Address)
VALUES
(9999, ‘Lionel’, ‘Messi’, ‘0745678901’, ‘15 Sunflower Lane’);
– 3.1.4 List all the records where the Student_Name has a letter ‘e’.
SELECT * FROM Student
WHERE Student_Name LIKE ‘%e%’;