Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
43 Cards in this Set
- Front
- Back
Relational Database Management System (RDBMS) is a system which:
|
1. data represented as collection of tables (relations)
2. tables are logical structures not physical ones. 3. The operators at the user level can generate new tables from old ones. |
|
Columns are called:
|
Attributes
|
|
Rows are called:
|
Tuples
|
|
Mathematical relations and database relations not are different. (True/False)
|
False
|
|
What does the domain define?
|
The nature of the values that can appear in each column of the relation.
|
|
The degree of a relation refers to what?
|
The number of attributes it has.
|
|
The cardinality a relation refers to what?
|
The number of tuples it has.
|
|
a primary key is:
|
a unique identifier for a relation
|
|
keys are based off of their semantic. (True/False)
|
True
|
|
Why are primary keys important
|
The only way a RDMS system can guarantee retrieving any individual tuple is via the combination (R,k), where R is the name of the relation and k is the primary key value of the tuple.
|
|
Foreign keys reference the relation with the primary key. (T/F)
|
True
|
|
What command is used to add new tuples into a table?
|
the INSERT INTO command.
INSERT INTO employee (last_name, first_name, id, home_phone, office_phone, department ) VALUES (‘Davidson’, ‘Jane’, ‘320’, ‘433-2071’, NULL, NULL); |
|
What type of operator is the SELECT command?
|
unary. it applies to only one relation and evaluates all tuples that are in it.
|
|
What does the PROJECT operator do?
|
produces a new relation which is a “vertical view” of the original relation. This operator extracts values from specified columns of a table with no duplicates.
|
|
What is the JOIN command used for?
|
It allows the processing of multi-table queries and the exercising of data relationships in a database.
|
|
SQL uses the SELECT statement for all of its queries? (T/F)
|
True
|
|
Data Retrieval Statements
|
SELECT
|
|
Data Definition Keywords
|
CREATE
ALTER DROP |
|
Data Manipulation Statement
|
INSERT
UPDATE DELETE COMMIT ROLLBACK |
|
Are SQL*Plus commands stored int the SQL buffer?
|
No
|
|
Execution Commands
|
RUN
EXECUTE LIST |
|
Environment Commands
|
SET
SHOW PAUSE |
|
Edit Commands
|
APPEND
CHANGE DEL INPUT EDIT |
|
File Manipulation Commands
|
SAVE
GET SPOOL @ / RUN |
|
Interactive Commands
|
DEFINE
PROMPT ACCEPT |
|
What is the syntax of a SELECT statement?
|
SELECT {Attribute | *} [, Attribute]
FROM {Table} [WHERE {condition}]; |
|
SELECT DISTINCT
|
used to select distinct tuples.
|
|
How is the JOIN operation completed?
|
JOIN operations are implemented using variations of the SELECT statement.
equi-join example SELECT * FROM staff, department WHERE staff.dept = department.dept ; |
|
How do you implement the LIKE command to find similar tuples?
|
SELECT *
FROM staff, department WHERE staff.dept = department.dept AND etitle LIKE 'EVAN%' ; |
|
What is the “worst case” of all possible joins.
|
CROSS PRODUCT
|
|
What must be true for both tables in order to preform a UNION or MINUS between their two SELECT statements?
|
each table must have the same number of columns and data types.
SELECT dept FROM staff UNION / MINUS SELECT fdept FROM faculty; |
|
How do you create a table?
|
CREATE TABLE table_name
( attribute datatype . . CONSTRAINT <constraint_name> PRIMPARY KEY (attribute) ); |
|
Why name a constraint?
|
it is easier to drop them without having to ALTER the table.
|
|
What is a CHECK CONSTRAINT?
|
It makes sure that an attribute has desired values.
CONSTRAINT <constraint_name> CHECK (attribute IN ('<accepted_value>', ...)) |
|
How do you name a primary key when defining the attribute?
|
model_name VARCHAR2(8) CONSTRAINT models_model_name_pk PRIMARY KEY,
|
|
How do you add a foreign key using the ALTER command?
|
ALTER TABLE cars
ADD CONSTRAINT cars_model_name_fk FOREIGN KEY (model_name) REFERENCES models (model_name); |
|
What does DESCRIBE table_name; do?
|
It shows the name, null value, and type of each attribute.
|
|
How do you add a new tuple to a table?
|
INSERT INTO <table_name> [(<attribute_list>)] VALUES (<attribute_values>)
|
|
What does &<value_id> do when using the INSERT VALUES command?
|
It prompts the user to:
"Enter value for <value_id>: |
|
What is the COMMIT command used for?
|
To make the changes to the database permanent.
|
|
What does the CASCADE CONSTRAINTS command do when dropping a table?
|
It will drop any constraints associated with the table (including foreign keys).
|
|
How do you edit an attributes datatype?
|
Using the MODIFY command:
ALTER TABLE employee MODIFY (last_name VARCHAR(30)); |
|
How do you give a new value to an attribute in a given tuple?
|
UPDATE cars SET miles_to_date = 67456
WHERE registration = ‘H286 MHU’; |