03-constraints.sql 433 B

123456789101112131415161718
  1. CREATE TABLE students (
  2. id INT,
  3. name VARCHAR(25) NOT NULL,
  4. major VARCHAR(25) UNIQUE,
  5. PRIMARY KEY(id)
  6. );
  7. .mode table
  8. .nullvalue NULL
  9. INSERT INTO students VALUES(1, 'Jack', 'Biology');
  10. INSERT INTO students VALUES(2, 'Kate', 'Sociology');
  11. INSERT INTO students VALUES(3, NULL, 'Chemistry');
  12. INSERT INTO students VALUES(4, 'Jack', 'Biology');
  13. INSERT INTO students VALUES(5, 'Mike', 'Computer Science');
  14. SELECT * FROM students;