SQL part 1 Flashcards

(34 cards)

1
Q

SQL is a database language for:

A
  • creating database and table structures
  • performing data manipulation and administration
  • querying the database to extract useful information
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

t/f: SQL is a nonprocedural language

A

true

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

what does “SQL is a nonprocedural language” mean

A

user specifies what must be done, but not how

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

with SQL, ______ isn’t important, only ______ matter

A

where the data is actually stored, the specified relations and relationships

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

SQL is an ______ standard

A

international

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

2 organizations that define the standard for SQL

A
  • American National Standards Institute (ANSI)
  • International Organization for Standardization (ISO)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

ISO is a consortium of how many countries

A

150

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

t/f: all relational DBMS software thus supports SQL

A

true

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

Different DBMS software that supports SQL

A
  • Oracle
  • MySQL
  • SQL Server
  • DB2
  • MS Access
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

many database vendors have developed

A

extensions

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

sql extensions

A

functions and commands
- basic, simple vocabulary of <100 “words”
- different software may have “dialects” with minor differences

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

categories of sql commands

A

data definition language (DDL) and data manipulation language (DML)

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

data definition language

A

commands that define a database, including creating, altering, dropping tables and stored procedures, and establishing constraints
(creating database structures)

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

data manipulation language

A

commands that are used to manipulate data and extract information

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

DML can be used for the commands

A

select, update, insert, delete

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

DDL primary commands

A
  • create table/create procedure
  • alter table
  • drop table (drop procedure)
17
Q

alter table command impacts

A

attributes or constraints

18
Q

3 command types within alter table

A
  • add (new attribute, primary key, NULL, etc)
  • modify (data type, etc)
  • drop (column)
19
Q

example of DDL syntax shows

A

SQL command keywords and user-provided parameters
**slide 7

20
Q

DDL data types

A
  • ANSI/ISO SQL data types
  • MySQL data types
21
Q

ANSI/ISO SQL data types

A
  • integer/smallint
  • decimal(precision, scale)
  • char(n) and varchar(n)
  • date (julian date format)
22
Q

mysql numeric data types

A

tinyint, smallint, mediumint, int, bigint, decimal
**slide 10 for ranges

23
Q

mysql date and time data types

A

date, datetime

24
Q

mysql string data types

A

char(n), varchar(n), blob, text, enum

25
decimal(M,D) means
M total digits, D digits after decimal
26
mysql date format
YYYY-MM-DD
27
invalid dates and times in mysql are converted to
zero values
28
built-in mysql date and time functions
now(), timestampdiff(), interval, date_format(), date(), time(), day(), year(), month()
29
char(n)
always allocates n bytes of storage
30
with varchar(n), values that exceed n characters in length are
truncated
31
varchar(n)
only allocates used space plus 1 byte
32
blob
used for large binary strings of data
33
text
used for large character strings of data
34
enum
string object with a value chosen from a list of permitted values that is specified at table creation time