SQL Commands Flashcards

Learn SQL (38 cards)

1
Q

Creates a database schema

A

CREATE SCHEMA AUTHORIZATION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Creates a new table

A

CREATE TABLE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Ensures that a column will not have null values

A

NOT NULL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Ensures that a column will not have duplicate values

A

UNIQUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Defines a primary key for a table

A

PRIMARY KEY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Defines a foreign key for a table

A

FOREIGN KEY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Defines a default value for a column

A

DEFAULT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Validates data in an attribute

A

CHECK

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Creates an index for a table

A

CREATE INDEX

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Creates a dynamic subset of rows/columns from one or more

tables

A

CREATE VIEW

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Modifies a tables definition (adds, modifies, or deletes attributes
or constraints)

A

ALTER TABLE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Creates a new table based on a query in the user’s database

schema

A

CREATE TABLE AS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Permanently deletes a table (and its data)

A

DROP TABLE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Permanently deletes an index

A

DROP INDEX

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Permanently deletes a view

A

DROP VIEW

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Inserts row(s) into a table

17
Q

Selects attributes from rows in one or more tables or views

18
Q

Restricts the selection of rows based on a conditional expression

19
Q

Groups the selected rows based on one or more attributes

20
Q

Restricts the selection of grouped rows based on a condition

21
Q

Orders the selected rows based on one or more attributes

22
Q

Modifies an attribute’s values in one or more table’s rows

23
Q

Deletes one or more rows from a table

24
Q

Permanently saves data changes

25
Restores data to their original values
ROLLBACK
26
Logical Operators
AND/OR/NOT
27
Comparison Operators
=, , =, <>
28
Checks whether an attribute value is within a range
BETWEEN
29
Checks whether an attribute value is null
IS NULL
30
Checks whether an attribute value matches a given string pattern
LIKE
31
Checks whether an attribute value matches any value within a value list
IN
32
Checks whether a subquery returns any rows
EXISTS
33
Limits values to unique values
DISTINCT
34
Returns the number of rows with non-null values for a given column
COUNT
35
Returns the minimum attribute value found in a given column
MIN
36
Returns the maximum attribute value found in a given column
MAX
37
Returns the sum of all values for a given column
SUM
38
Returns the average of all values for a given column
AVG