SQL Commands Flashcards
Learn SQL (38 cards)
Creates a database schema
CREATE SCHEMA AUTHORIZATION
Creates a new table
CREATE TABLE
Ensures that a column will not have null values
NOT NULL
Ensures that a column will not have duplicate values
UNIQUE
Defines a primary key for a table
PRIMARY KEY
Defines a foreign key for a table
FOREIGN KEY
Defines a default value for a column
DEFAULT
Validates data in an attribute
CHECK
Creates an index for a table
CREATE INDEX
Creates a dynamic subset of rows/columns from one or more
tables
CREATE VIEW
Modifies a tables definition (adds, modifies, or deletes attributes
or constraints)
ALTER TABLE
Creates a new table based on a query in the user’s database
schema
CREATE TABLE AS
Permanently deletes a table (and its data)
DROP TABLE
Permanently deletes an index
DROP INDEX
Permanently deletes a view
DROP VIEW
Inserts row(s) into a table
INSERT
Selects attributes from rows in one or more tables or views
SELECT
Restricts the selection of rows based on a conditional expression
WHERE
Groups the selected rows based on one or more attributes
GROUP BY
Restricts the selection of grouped rows based on a condition
HAVING
Orders the selected rows based on one or more attributes
ORDER BY
Modifies an attribute’s values in one or more table’s rows
UPDATE
Deletes one or more rows from a table
DELETE
Permanently saves data changes
COMMIT