SQL: A Commercial Database Language Flashcards
(141 cards)
The name SQL is derived from
Structured Query Language
Sequel was originally called ______.
SEQUEL ( for Structure English QUEry Language).
What does it mean that SQL is a comprehensive database language?
It has statements for data defintion, query and update (in this sense it is both a DDL and a DML). In addiotion, it has facitilities for defining views, for specifying security anduthorization, for defining integrity constaints, and for specifying transaction controls. It also has rules for embedding SQL statements into a general-purpose programming language.
The SQL language provides a high-level declarative language interface meaning
The SQL language provides a high-level declarative language interface meaning the user specifies what the result is to be and leaves the decisions on how to execute the query to the DBMS.
The terms table, row, and column are used in SQL in documents for ____, ____ and ____ respectively.
table = relation
row = tuple
column = attribute
is SQL case sensitive?
No. It treats upper and lower case letters as the same letter. Only inside quotes does SQL make a distinction between upper and lower case letters.
The concept of ____ is used in SQL to group together constructs that belong to the same database application
schema
A schema includes ______ such as tables constraints, view, domains, authorization grants and other constructs.
schema elements
A SQL schema is identified by a schema name and includes an _______ to indicate the user who owns the scema. In addition, it can include _______ for every element in the schema.
authorization identifier ; descriptors
Write a SQL statement that creates a schema called COMPANY owned by a user with authorization identifier JSMITH
CREATE SCHEMA COMPANY AUTHORIZATION JSMITH;
The concept of a ______ is used in SQL to denote a named collection of schemas.
catalog
A catalog always contains a special schema called _____. This schema provides information on all the schemas in the catalog and all the element descriptors in these schemas.
INFORMATION_SCHEMA
True or False: Some elements (e.g. domain definitions) can be shared by schemas in the same catalog.
Integrity constraints can be defined between relations only if they do not exist in schedmas of the same catalog
True.
False. Integrity constraints can be defined between relations only if they exist in schemas of the same catalog.
What data types are included in SQL?
numerics, character-string, bit-string, data and time.
What are the numeric types in SQL and how are they specified?
What are the character string data types in SQL and how are they specified?
What are the bit string data types in SQL and how are they specified?
What are the data and time data types in SQL and how are they specified?
How do you create a domain in SQL on SSN_TYPE to be a character data type consisting of 9 characters?
CREATE DOMAIN SSN_TYPE AS CHAR(9);
A create domain statement can have an optional _______ and an optional
_____________.
.
default specification ; list of constraints
What does the CREATE TABLE command do?
The CREATE TABLE command is used to specify a new relation, its attributes, their data types and constraints.
The key, entity integrity and referential integrity constraints can be specified within a CREATE TABLE statement or later using the ALTER TABLE command.
Create a relation named department with attributes: DNAME, DNUMBER, MGRSSN, MGRSTARTDATE. The primary key is DNUMBER and the MGRSSN and EMPLOYEE are foreign keys. DNAME is a secondary key (unique). Write a command to create this relation.
A constraint can be given a name following the keyword ________. Giving names to constraints, is:
A) optional but is a good practice to follow.
B) necessary and a bad practice to follow.
C) unnecessary but a bad practice to follow.
D) necessary and a good practice to follow.
CONSTRAINT;
A) optional but is a good practice to follow.
True or False: The names of some of the constraints within a particular can match (not unique).
False. The names of all constraints withing a particular schema must be unique. A constraint name can be used to drop a constraint (and replace it later by another constraint).



