Except where otherwise noted, the contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller.
name | course | grade | |
---|---|---|---|
Bart | bart@fox.com | Computer Science 142 | B- |
Bart | bart@fox.com | Computer Science 143 | C |
Milhouse | milhouse@fox.com | Computer Science 142 | B+ |
Lisa | lisa@fox.com | Computer Science 143 | A+ |
Lisa | lisa@fox.com | Computer Science 190M | A+ |
Ralph | ralph@fox.com | Informatics 100 | D+ |
|
|
|
|
|
|
Student
table with student_id
of 888 is Lisa Simpson's student infoGrade
table with student_id
of 888 are Lisa Simpson's course grades
|
|
|
|
|
teachers
table containing information about instructorsteachers
table and put the teacher's name as a column in courses
?
CREATE TABLE
statement
(A.1.2)
CREATE TABLE name ( columnName type constraints, ... columnName type constraints );
CREATE TABLE students ( sid INTEGER UNSIGNED NOT NULL PRIMARY KEY, name VARCHAR(20), email VARCHAR(32) );
NOT NULL
for a field that cannot be blank or PRIMARY KEY
for a column that must be unique for every rowCREATE DATABASE
, DROP TABLE
, ALTER TABLE
BOOLEAN
INTEGER
FLOAT
VARCHAR
: a stringDATE
, TIME
, DATETIME
BLOB
: binary data