SQL Tutorial Flashcards

(58 cards)

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
SQL Command: INSERT INTO
inserts new data into a database
26
SQL Command: CREATE DATABASE
creates a new database
27
SQL Command: ALTER DATABASE
modifies a database
28
SQL Command: CREATE TABLE
creates a new table
29
SQL Command: ALTER TABLE
modifies a table
30
SQL Command: DROP TABLE
deletes a table
31
SQL Command: CREATE INDEX
creates an index (search key)
32
SQL Command: DROP INDEX
deletes an index
33
Semicolon after SQL Statements
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
The SQL SELECT Statement
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
SELECT column1, column2, ... FROM table_name;
SELECT Syntax
36
If you want to select all the fields available in the table...
SELECT * FROM table_name;
37
The SQL SELECT DISTINCT Statement
The SELECT DISTINCT statement is used to return only distinct (different) values
38
SELECT DISTINCT column1, column2, ... FROM table_name;
SELECT DISTINCT Syntax
39
The SQL WHERE Clause
The WHERE clause is used to filter records
40
SELECT column1, column2, ... FROM table_name WHERE condition;
WHERE Syntax
41
SELECT COUN(DISTINCT column) FROM table_name;
This stastement lists the number of different (distinct) customer countries (is not supported in Microsoft Access)
42
Text Fields vs. Numeric Fields
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
Operators in The WHERE Clause (1) =
Equal
44
Operators in The WHERE Clause (2) >
Greater than
45
Operators in The WHERE Clause (3) <
Less than
46
Operators in The WHERE Clause (4) >=
Greater than or equal
47
Operators in The WHERE Clause (5) <=
Less than or equal
48
Operators in The WHERE Clause (6) <>
Not equal Note: In some versions of SQL this operator may be written as !=
49
Operators in The WHERE Clause (7) BETWEEN
Between a certain range
50
Operators in The WHERE Clause (8) LIKE
Search for a pattern
51
Operators in The WHERE Clause (9) IN
To specify multiple possible values for a column
52
The SQL AND Operator
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
The SQL OR Operator
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
The SQL NOT Operator
The NOT operator displays a record if the condition(s) is NOT TRUE
55
SELECT column1, column2, ... FROM table_name WHERE condition1 AND condition2 AND condition3 ...;
AND Syntax
56
SELECT column1, column2, ... FROM table_name WHERE condition1 OR condition2 OR condition3 ...;
OR Syntax
57
SELECT column1, column2, ... FROM table_name WHERE NOT condition;
NOT Syntax
58
Combining AND, OR and NOT
You can also combine the AND, OR and NOT operators