SQL Tutorial Flashcards

1
Q

SQL stands for…

A

Structured Query Language

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

SQL lets you…

A

access and manipulate databases

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

What can SQL do? (1)

A

SQL can execute queries against a database

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

What can SQL do? (2)

A

SQL can retrieve data from a database

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

What can SQL do? (3)

A

SQL can insert records in a database

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

What can SQL do? (4)

A

SQL can update records in a database

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

What can SQL do? (5)

A

SQL can delete records from a database

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

What can SQL do? (6)

A

SQL can create new databases

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

What can SQL do? (7)

A

SQL can create new tables in a database

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

What can SQL do? (8)

A

SQL can create stored procedures in a database

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

What can SQL do? (9)

A

SQL can create views in a database

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

What can SQL do? (10)

A

SQL can set permissions on tables, procedures, and views

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

RDBMS stands for…

A

Relational Database Management System

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

RDBMS is…

A

the basis for SQL, and for all modern database systems such as MS SQL Server, IBM, DB2, Oracle, MySQL, and Microsoft Access

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

The data in RDBMS is stored in…

A

database objects called tables

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

A table is…

A

a collection of related data entries and it consists of columns and rows

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

Every table is broken up into…

A

smaller entities called fields

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

A field is…

A

a column in a table that is designed to maintain specific information about every record in the table

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

A record, also called a row, is…

A

each individual entry that exists in a table

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

A record is…

A

a horizontal entity in a table

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

A column is…

A

a vertical entity in a table that contains all information associated with a specific field in a table

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

SQL Command: SELECT

A

extracts data from a database

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

SQL Command: UPDATE

A

updates data in a data base

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

SQL Command: DELETE

A

deletes data from a database

25
Q

SQL Command: INSERT INTO

A

inserts new data into a database

26
Q

SQL Command: CREATE DATABASE

A

creates a new database

27
Q

SQL Command: ALTER DATABASE

A

modifies a database

28
Q

SQL Command: CREATE TABLE

A

creates a new table

29
Q

SQL Command: ALTER TABLE

A

modifies a table

30
Q

SQL Command: DROP TABLE

A

deletes a table

31
Q

SQL Command: CREATE INDEX

A

creates an index (search key)

32
Q

SQL Command: DROP INDEX

A

deletes an index

33
Q

Semicolon after SQL Statements

A

Semicolon is the standard way to separate each SQL statement in database systems that allow more than one SQL statement to be executed in the same call to the server

34
Q

The SQL SELECT Statement

A

The SELECT statement is used to select data from a database. The data returned is store in a result table, called the result-set

35
Q

SELECT column1, column2, …
FROM table_name;

A

SELECT Syntax

36
Q

If you want to select all the fields available in the table…

A

SELECT * FROM table_name;

37
Q

The SQL SELECT DISTINCT Statement

A

The SELECT DISTINCT statement is used to return only distinct (different) values

38
Q

SELECT DISTINCT column1, column2, …
FROM table_name;

A

SELECT DISTINCT Syntax

39
Q

The SQL WHERE Clause

A

The WHERE clause is used to filter records

40
Q

SELECT column1, column2, …
FROM table_name
WHERE condition;

A

WHERE Syntax

41
Q

SELECT COUN(DISTINCT column) FROM table_name;

A

This stastement lists the number of different (distinct) customer countries (is not supported in Microsoft Access)

42
Q

Text Fields vs. Numeric Fields

A

SQL requires single quotes around text values (most database systems will also allow double quotes)
However, numeric fields shoud not be enclosed in quotes

43
Q

Operators in The WHERE Clause (1)

A

Equal

44
Q

Operators in The WHERE Clause (2)
>

A

Greater than

45
Q

Operators in The WHERE Clause (3)
<

A

Less than

46
Q

Operators in The WHERE Clause (4)
>=

A

Greater than or equal

47
Q

Operators in The WHERE Clause (5)
<=

A

Less than or equal

48
Q

Operators in The WHERE Clause (6)
<>

A

Not equal
Note: In some versions of SQL this operator may be written as !=

49
Q

Operators in The WHERE Clause (7)
BETWEEN

A

Between a certain range

50
Q

Operators in The WHERE Clause (8)
LIKE

A

Search for a pattern

51
Q

Operators in The WHERE Clause (9)
IN

A

To specify multiple possible values for a column

52
Q

The SQL AND Operator

A

The AND operator are used to filter records based on:
The AND operator displays a record if all the conditions separated by AND are TRUE

53
Q

The SQL OR Operator

A

The OR operator are used to filter records based on:
The OR operator displays a record if any of the conditions separated by OR is TRUE

54
Q

The SQL NOT Operator

A

The NOT operator displays a record if the condition(s) is NOT TRUE

55
Q

SELECT column1, column2, …
FROM table_name
WHERE condition1 AND condition2 AND condition3 …;

A

AND Syntax

56
Q

SELECT column1, column2, …
FROM table_name
WHERE condition1 OR condition2 OR condition3 …;

A

OR Syntax

57
Q

SELECT column1, column2, …
FROM table_name
WHERE NOT condition;

A

NOT Syntax

58
Q

Combining AND, OR and NOT

A

You can also combine the AND, OR and NOT operators