Relational Data Model Flashcards
What is a relational database?
A set of relations
What are the two parts of a relation?
Instance (table) and Scheme (name, plus attributes)
What is the cardinality of a relation?
Number of Rows
What is the degree of a relation?
Number of columns
What is the DDL used for?
Creation, Deletion, Updating, Truncate, Rename relation
What is the simple form of creating a relation?
CREATE TABLE ( ssn INTEGER );
What are the 4 most common data types?
INT, REAL, CHAR(n), VARCHAR(n)
What is the form of the data value?
yyyy-mm-dd
What is the form of the time value?
hh:mm:ss.ss
What is the syntax to delete a relation?
DROP TABLE ;
How do you add any existing attribute to a relation scheme
ALTER TABLE ADD
How do you remove an attribute from a relation?
ALTER TABLE DROP
How do you insert a single tuple?
INSERT INTO Students(sid, name) VALUES (53, ‘Smith’)
Do you delete all tuples satisfying some condition?
DELETE
FROM Students S
WHERE S.name = ‘Smith’
What are integrity constraints?
Conditions that must be true for any instance of the database