CREATE DATABASE databaseName;CREATE TABLE tableName ( column1 dataType, column2 dataType constraint, column3 dataType);DROP TABLE tableName;TRUNCATE TABLE tableName;ALTER TABLE tableName ADD PRIMARY KEY (primaryKey);ALTER TABLE tableName2 ADD FOREIGN KEY (primaryKey) REFERENCES tableName(primaryKey);ALTER TABLE tableNameADD columnName dataType;ALTER TABLE tableNameDROP COLUMN columnName;ALTER TABLE tableNameALTER COLUMN columnName newDataType;ensures that a column cannot have a NULL (empty) value
ensures that all values in a column are different
a combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table
uniquely identifies a row/record in another table
ensures that all values in a column satisfies a specific condition
sets a default value for a column when no value is specified
used to create and retrieve data from the database very quickly
Also known as Data Manipulation Language.
INSERT INTO Band ('ComputerKidz', 5);INSERT INTO Band-Booking (BandName, BookingID) VALUES ('ComputerKidz', '2016/023');UPDATE Band SET NumberOfMembers = 6;DELETE FROM BandName WHERE BandName = 'ITWizz';SELECT BandName FROM Band ORDER BY BandName;SELECT BandName FROM Band-Booking WHERE Headlining = 'Y' GROUP BY BandName;selects an attribute
locates attribute's table: 'Band'
produces an ordered list, sorted by 'BandName'
identifies items in 'BandName' that have the Headlining attribute as 'Y'
groups (puts together) these identified items by 'BandName'