Lesson 2.5: Defining a Relation Schema in SQL Flashcards

1
Q

SQL is pronounced as ‘——’

A

sequel

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

principal language used to describe and manipulate relational databases

A

sql

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

There are two aspects to SQL

A
  1. The Data-Definition sublanguage for declaring database schemas and
  2. The Data-Manipulation sublanguage for querying (asking questions about) databases and for modifying the database.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

SQL makes a distinction between three kinds of relations

A
  1. Stored relations, which are called tables. These are the kind of relation we deal with ordinarily — a relation that exists in the database and that can be modified by changing its tuples, as well as queried.
  2. Views, which are relations defined by a computation. These relations are not stored, but are constructed, in whole or in part, when needed.
  3. Temporary tables, which are constructed by the SQL language processor when it performs its job of executing queries and data modifications. These relations are then thrown away and not stored.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Data types in SQL

A

Character strings – CHAR(n) and VARCHAR(n)
Bit strings – BIT(n) and BIT VARYING(n)
Boolean
Integer (INT, SHORT INT)
Floating-point numbers (FLOAT, REAL, DOUBLE PRECISION, DECIMAL(n,d), NUMERIC)
date and time (DATE, TIME)

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

a fixed-length string of up to n characters, implies that short strings are padded to make n characters

A

CHAR(n)

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

denotes a string of up to n characters, implies that an end-marker or string-length is used

A

VARCHAR(n)

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

denotes bit strings of length n

A

BIT(n)

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

denotes bit strings of length up to n

A

BIT VARYING(n)

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

type for typical floating-point numbers

A

FLOAT or REAL

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

A higher precision of floating numbers can be obtained with the type

A

DOUBLE PRECISION

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

allows values that consist of n decimal digits, with the decimal point assumed to be d positions from the right.

A

DECIMAL(n,d)

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

is almost a synonym for DECIMAL, although there are possible implementation-dependent differences.

A

NUMERIC

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