Basic terminology Flashcards

1
Q

What is the Unique Identifier in this table.
What is another name for a Unique Identifier

A

ID is one of 5 fields (collums are fields rows are records)
ID is the Unique Identifier.
Unique Identifier is often called the KEY

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

Out of the Following what are correct and incorrect suggestions as to how to make the table better:
- Customers Field should be renamed
-Underscores in field names should be replaced with spaces
- The table name should be made singular
- The field names should be made singular
- The table name should not be Capital
- The field names should be made capital

A

Good improvements:
- Customers Field should be renamed
- The field names should be made singular
- The table name should not be Capital

Incorrect changes
- Underscores in field names should be replaced with spaces
- The table name should be made singular
- The field names should be made capital

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

What is the data type for
words/Strings:
years, whole numbers etc:
fractions floats 2.05 etc:

A

Strings: VARCHAR
Integers: INT
floats: NUMERIC

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

what does a Schema show

A

the Database design
- what tables are included
- any relationships between the tables
- what data type each field can hold

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

What is the best way to store each of the data:
Phone number (321-123-321)
model year (1999)
product review written
number of subscribers (9020)
Weight in Tonnes (5.45)
Price in dollars ($4.50)

A

Phone number (321-123-321): VARCHAR
model year (1999): INT
product review written: VARCHAR
number of subscribers (9020): INT
Weight in Tonnes (5.45): NUMERIC
Price in dollars ($4.50): NUMERIC

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

What are “Key Words”
and what are the 2 most common

A

reserved words for operations
SELECT
FROM

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

What do the
SELECT and FROM keywords do?

A

SELECT: indicates which FIELDS should be selected
FROM: indicates from which TABLE these fields should be located

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

How would you select the name filed from the patrons table?

How would you select all fields from the patrons table?

A

SELECT name
FROM patron ;

SELECT *
FROM patron;

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

List the things wrong with this Query.

A
  • make CARD_NUM and TOTAL_FINE lower case
  • add an ; at the end of the query
  • capitalise FROM

SELECT card_num, total_fine
FROM patrons;

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

how do you change a field (column) header when you query?
what is this called?

use a table with fields, name (return as first_name) and year_hired from a Table employees

A

Aliasing AS:
SELECT name AS first_name, year_hired
FROM employees;

changes the header of name to first_name

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

How can you remove doubled up information (list of unique values).
example: years hired may have multiple values of 2021 how can we group them?

A

DISTINCT
SELECT DISTINCT year_hired
FROM employees;

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

write a query to look at the different years that departments hired employees.

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

What is a View:

A
  • Considered Virtual tables
  • Data contained is not stored in the database
  • It is query code stored for future use
  • when the view is accessed it updates the query results to account for any updates to the underlying data base
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

create a view with the name; employee hire years. With fields; id, name, year_hired. From the table; employees.

A

CREATE VIEW employee_hire_years AS
SELECT id, name, year_hired
FROM employees;

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