Lesson 2 - Introduction to SQL Flashcards

1
Q

A standard language for storing, manipulating and retrieving data in databases.

A

SQL!
stands for Structured Query Language

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

ANSI stands for…?

Bonus Tip: SQL is an ANSI standard

A

AMERICAN NATIONAL STANDARDS INSTITUTE

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

for defining the database structure and controlling access to the data.

  • CREATE
  • DROP
  • ALTER
A

DDL (DATA DEFINTION LANGUAGE)

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

for retrieving and updating data.
* INSERT INTO
* SELECT
* UPDATE
* DELETE

A

DML (Database Manipulation System)

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

creates an object ( a table, for example) in the database.

A

SQL CREATE STATEMENT
CREATE DATABASE database_name;

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

deletes an object in the databases usually irretrie

A

SQL DROP STATEMENT
DROP DATABASE database_name;

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

modifies the structure an existing object in various ways. For example, adding a column to an existing table.

A

SQL ALTER STATEMENT
ALTER TABLE table_name;

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

Each column in a database table is required to have a name and a data type.

A

SQL BASIC DATA TYPES

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

SQL String Data Types (3)

A

CHAR
* VARCHAR
* TEXT

CHAR(size) Fixed length is 0-255. Default is 1.
VARCHAR(size) - variable length is 0-65535 characters.
TEXT - holds a string with a maximum length of 65, 535 bytes.

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

SQL Numeric Data Types (3)

A

INT
* FLOAT
* BOOLEAN

Boolean - zero is false, and nonzero is true

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

SQL Date and Time Data Types (4)

A

DATE
* DATETIME
* TIME
* YEAR

Date format is YYYY-MM-DD
Time format is hh:mm:ss

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

used to specify rules for the data in a table.

A

SQL CONSTRAINTS

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

SQL Constraints contains the…?

A
  • NOT NULL
  • UNIQUE
  • PRIMARY KEY
  • FOREIGN KEY
  • CHECK
  • DEFAULT
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

is used to select data from a database.

A

SQL SELECT STATEMENT
SELECT*FROM table_name

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

can be used to return only distinct (different) values.

A

SQL DISTINCT STATEMENT
SELECT DISTINCT column_name1, column_name2 FROM table_name

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

is used to filter records, (numeric fields should not be enclosed in quotes)

A

SQL WHERE CLAUSE
SELECT column_name,column_name FROM table_name WHERE condition

17
Q

The ____ displays a record if both the first condition and the second condtion are true.

A

AND operator

18
Q

The ____ displays a record if either the first condition or the second condition is true.

A

** OR operator**

19
Q

The ____ keyword is used to sort the result-set by one or more columns.

A

ORDER BY

20
Q

The ____ is used in a WHERE clause to search for a specified pattern in a column.

A

LIKE operator

21
Q

character that can be used to substitute

A

WILDCARD

%- A substitute for zero or more characters
_ - A substitute for a single character.
[charlist] - Sets and ranges of characters to match.
[^charlist] or [!charlist] - Matches only a character NOT specified within the brackets.

22
Q

The ____ operator allows you to specify multiple values in a WHERE clause.

A

IN

23
Q

The ____ operator selects values within a range.

A

BETWEEN

24
Q

The ____ statement is used to insert new records in a table.

A

INSERT INTO

25
Q

The ____ statement is used to update existing records in a table.

A

UPDATE
duh:0

26
Q

The ____ statement is used to delete rows in a table.

A

DELETE
well duh:D

27
Q

The ____ function returns the number of rows that matches a specified criteria.

A

COUNT()

28
Q

The ____ function returns the average value of a a numeric column.

A

AVG()

29
Q

The ____ function returns the total sum of a numeric column.

A

SUM()

30
Q

The ____ function returns the smallest value of the selected column, while the ____ function returns the largest.

A

MIN
and
MAX