Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

CREATE TABLE students (

students_id INT PRIMARY KEY AUTO_INCREMENT,


name VARCHAR (20) NOT NULL,
major VARCHAR (20) UNIQUE DEFAULT'undifined'
);
DESCRIBE students;

DROP TABLE students;

ALTER TABLE students ADD gpa DECIMAL(3,2);

ALTER TABLE students DROP gpa;


SELECT * FROM students

WHERE major <> 'sci';

ORDER BY name, major DESC


LIMIT 2;

INSERT INTO students(name, major) VALUES('Susant', 'Computer');


INSERT INTO students(name, major) VALUES('Rob', 'Phy');
INSERT INTO students(name, major) VALUES('Jack', 'sci');

UPDATE students
SET name = 'Tom', major = 'undecided'
WHERE students_id = 1;

DELETE FROM students


WHERE students_id = 1;

You might also like