Final Take 2 Flashcards
TINYINT
Maximum value unsigned 255, signed -128, 128
BOOLEAN
Not directly implemented in MySQL, instead TINYINT(1); 0=False; 1=True
ENUM
Allows a fixed number of pre-defined values to be specified
AUTO_INCREMENT
Can be used with whole number data types to automatically supply a value incremented by 1, for each record inserted.
To utilize, include in attribute specification, then don’t supply a value for the respective attribute when inserting new records
0 or NULL will also cause an automatic value to be used for the respective attribute
INSERT using value(s) from another table
nstead of looking up values needed to compose an INSERT statement, include a query that will find and use the
needed values
Foreign Key specifications
ON UPDATE and/or ON DELETE
§ CASCADE
§ SET NULL
§ SET DEFAULT
§ NO ACTION
Alter Table: Add/Drop Foreign Key Constraint
You can’t modify a FOREIGN KEY constraint; it must be dropped and added.
ALTER TABLE tablename
DROP FOREIGN KEY constraint_name_fk;
SELECTION
performed through the WHERE clause
PROJECTION
performed through the SELECT clause of SELECT statement
UNION
SELECT column_name(s) FROM table1
UNION
SELECT column_name(s) FROM table2;
DIFFERENCE
SELECT *
FROM salesRep
WHERE empID NOT IN (
SELECT empNum
FROM techSalesRep);
PRODUCT
SELECT *
FROM salesRep INNER JOIN techSalesRep;
INTERSECTION
SELECT salesRep.firstName, salesRep.lastName, salesRep.city, salesRep.state
FROM salesRep
WHERE empID IN (
SELECT empNum
FROM techSalesRep);
EQUIJOIN
SELECT *
FROM territory INNER JOIN district
ON territory.distID = district.distID;
NATURAL JOIN
SELECT territory.terrID,
territory.terrName,
territory.salesRepID,
district.distID,
distName
FROM territory INNER JOIN district
ON territory.distID = district.distID;