SQL Commands Flashcards

Learn SQL

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

A

INSERT

17
Q

Selects attributes from rows in one or more tables or views

A

SELECT

18
Q

Restricts the selection of rows based on a conditional expression

A

WHERE

19
Q

Groups the selected rows based on one or more attributes

A

GROUP BY

20
Q

Restricts the selection of grouped rows based on a condition

A

HAVING

21
Q

Orders the selected rows based on one or more attributes

A

ORDER BY

22
Q

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

A

UPDATE

23
Q

Deletes one or more rows from a table

A

DELETE

24
Q

Permanently saves data changes

A

COMMIT

25
Q

Restores data to their original values

A

ROLLBACK

26
Q

Logical Operators

A

AND/OR/NOT

27
Q

Comparison Operators

A

=, , =, <>

28
Q

Checks whether an attribute value is within a range

A

BETWEEN

29
Q

Checks whether an attribute value is null

A

IS NULL

30
Q

Checks whether an attribute value matches a given string pattern

A

LIKE

31
Q

Checks whether an attribute value matches any value within a value list

A

IN

32
Q

Checks whether a subquery returns any rows

A

EXISTS

33
Q

Limits values to unique values

A

DISTINCT

34
Q

Returns the number of rows with non-null values for a given column

A

COUNT

35
Q

Returns the minimum attribute value found in a given column

A

MIN

36
Q

Returns the maximum attribute value found in a given column

A

MAX

37
Q

Returns the sum of all values for a given column

A

SUM

38
Q

Returns the average of all values for a given column

A

AVG