Basic SQL Flashcards
(146 cards)
SQL stands for
Structured Query Language
SQL is a comprehensive database language, meaning
It has statements for data definitions, queries, and updates
DDL stands for
Data Definition Language
DML stands for
Data Manipulation Language
SQL standards are divided into
Core specification PLUS specialized extensions
SQL core
supposed to be implemented by all RDBMS veodors that are SQL complaint
SQL extensions
can be implemented as optional modules to be purchased independently for specific DB applications such as data mining, spatial data, temporal data, data warehousing, online analytical processing, etc
Table row and column correspond to relational model terms
relation, tuple, attribute
CREATE statement can create
schemas, tables, domains, as well as views, assertions, triggers
SQL schema is
a DB structure
SQL schema is identified by
schema name, and includes authorization identifier to indicate the user or account who owns the schema, as well as descriptors for each element in the schema
Schema elements include
tables, constraints, views, domains, and other constructs (authorization grants) that describe the schema
How to create schema (2 ways)
CREATE schema statement that can include all schema element definitions
Can be assigned name and authorization identifier and the elements can be defined later
Create schema called COMPANY owned by user with authorization identifier Jsmith
CREATE SCHEMA COMPANY AUTHORIZATION ‘Jsmith’;
catalog
collection of schemas in SQL environment
SQL environemnt
installation of an SQL-compliant RDBMS on a computer system
a catalog always contains a special schema called
INFORMATION_SCHEMA
INFORMATION_SCHEMA provides
information on all the schemas in the catalog and all the element descriptors in these schemas
CREATE TABLE command used for
specify new relation by giving it name and specifying its attributes and initial constraints
Order how attributes are specified when creating table
attribute name, data type to specify domain of values, any constraints (NOT NULL)
When are key, entity integrity, and referential integrity constraints specified
within CREATE TABLE statement after the attributes are declared or can be added later using the ALTER TABLE command
can explicitly attach schema name to relation name, separated by a period
CREATE TABLE COMPANY.EMPLOYEE rather than CREATE TABLE EMPLOYEE
base relations are created through
CREATE TABLE statements
base relations
relation and its tuples are created and stored as a file by the DBMS