ISTM 315 Exam 2

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/449

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:55 AM on 10/17/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

450 Terms

1
New cards

SQL

2
New cards

Structured Query Language. The language of relational database systems; if you're interacting with an RDBMS, you're using SQL.

3
New cards

RDBMS

4
New cards

Relational database management system. Manages data as a collection of tables, with all relationships represented by common values in related tables.

5
New cards

How relationships are represented in an RDBMS

6
New cards

As equalities between a primary key in one table and a foreign key in another.

7
New cards

SQL and non-relational systems

8
New cards

Languages for non-relational DBMSs (e.g., Hive, Pig) still build on SQL as a foundation, so SQL knowledge carries over.

9
New cards

Schema

10
New cards

The structure that contains descriptions of user-created objects such as base tables, views, and constraints. Essentially everything you think of as "the database."

11
New cards

CREATE SCHEMA vs CREATE DATABASE (MySQL)

12
New cards

Treated as synonyms; same effect.

13
New cards

Schemas per DBMS

14
New cards

A single DBMS can manage several schemas at once. MySQL Workbench's schema navigator (left panel) lists every database you can access.

15
New cards

Three main segments of SQL

16
New cards

DDL (Data Definition Language), DML (Data Manipulation Language), DCL (Data Control Language).

17
New cards

DDL (Data Definition Language)

18
New cards

Commands that define/build a database: create, alter, and drop tables, and establish constraints on and between them.

19
New cards

DML (Data Manipulation Language)

20
New cards

Commands that maintain and query a database: INSERT, UPDATE, DELETE, SELECT. Most course time is spent here.

21
New cards

DCL (Data Control Language)

22
New cards

Commands that control the database, including administering privileges and committing data. The DBA's realm; mostly out of scope for this course.

23
New cards

DBA

24
New cards

Database administrator. Responsible for the data itself and for who gets access to it.

25
New cards

CREATE statement

26
New cards

First major DDL statement. Creates objects in a DBMS: a schema/database, a table, a view, etc.

27
New cards

CREATE SCHEMA / CREATE DATABASE

28
New cards

Defines a portion of the database owned by a particular user; the home where tables and their relationships live.

29
New cards

CREATE SCHEMA syntax

30
New cards

CREATE SCHEMA customerdb; (Refresh the schema navigator to see it. It is empty until you add tables.)

31
New cards

Class convention: CREATE SCHEMA or CREATE DATABASE?

32
New cards

Use CREATE SCHEMA.

33
New cards

CREATE TABLE

34
New cards

Defines a new table and its columns.

35
New cards

CREATE VIEW

36
New cards

Defines a logical table from one or more tables or views, or from a SQL query. Not covered in class because views work so much like tables.

37
New cards

Other CREATE statements (not used in class)

38
New cards

CHARACTER SET, COLLATION, TRANSLATION, ASSERTION, DOMAIN.

39
New cards

Steps in creating a table (in order)

40
New cards

1) Identify data types for attributes. 2) Identify columns that can/cannot be null. 3) Identify PK/FK mates. 4) Determine default values. 5) Identify constraints on columns (domain specs, allowable values). 6) Create the table and associated indexes.

41
New cards

Required vs optional fields: default stance

42
New cards

Require most information by default. Making a field optional needs a business reason.

43
New cards

Where PK/FK mates come from

44
New cards

Logical modeling, specifically the relational schema.

45
New cards

Default values: best practice

46
New cards

Use sparingly, only when there's a specific need. Defaults can go wrong.

47
New cards

Good default value example

48
New cards

Order date set to the system date/time when the transaction is recorded.

49
New cards

Column constraints

50
New cards

Domain specifications and restrictions on a column's allowable values.

51
New cards

Six data types for class

52
New cards

BOOLEAN, DATETIME, DECIMAL, INTEGER, CHAR, VARCHAR. Covers most business needs.

53
New cards

Data type decision tree (in order)

54
New cards

1) True/false or yes/no? BOOLEAN. 2) Date or time? DATETIME. 3) Doing math? Needs decimal places: DECIMAL; otherwise INTEGER. 4) Not doing math? Fixed length: CHAR; variable length: VARCHAR.

55
New cards

BOOLEAN

56
New cards

For true/false or yes/no data, stored as 0 or 1. Some systems call it BOOL or TINYINT; same idea.

57
New cards

DATETIME

58
New cards

For anything temporal. Stores date and time together as one value. Exists on almost every DBMS.

59
New cards

DECIMAL

60
New cards

For numbers used in math that need decimal places. Stores exact numbers with specified precision. Fixed-point, not floating-point; the most precise decimal type.

61
New cards

INTEGER

62
New cards

For numbers used in math that don't need decimal places. Exact numbers with predefined precision and a scale of 0.

63
New cards

CHAR

64
New cards

Fixed-length string; can't be bigger or smaller than the declared size. Example: US state code as CHAR(2).

65
New cards

VARCHAR

66
New cards

Variable-length string ("varying character"). Declared size is a maximum; unused space is freed, so memory is allocated efficiently.

67
New cards

Number-like data you don't do math with

68
New cards

Store as a string type (CHAR/VARCHAR), not numeric. Examples: phone numbers, zip codes.

69
New cards

Phone number data type

70
New cards

US only (always 10 digits): CHAR. International (lengths vary): VARCHAR.

71
New cards

Zip code data type

72
New cards

CHAR (5 or 9, depending on what you store). You never average zip codes.

73
New cards

Salary data type

74
New cards

DECIMAL or INTEGER, because you do math with it.

75
New cards

Sizing VARCHAR

76
New cards

Be generous (e.g., 50 for last name) so you never lose or truncate data. Unused space is freed.

77
New cards

Why not make everything VARCHAR(2000)?

78
New cards

1) You'll hit DBMS limits; the DBMS must guarantee it can store the declared size. 2) It's lazy. Ballpark a size and err large.

79
New cards

CREATE TABLE syntax

80
New cards

CREATE TABLE customer ( field definitions, constraints ); Open parentheses after the table name, list field definitions, then constraints, then close.

81
New cards

CREATE TABLE formatting

82
New cards

Technically one statement that could be one line. Put each field definition and constraint on its own line for readability and debugging.

83
New cards

Field definition format

84
New cards

field_name DATA_TYPE NOT NULL e.g., customer_id INTEGER NOT NULL

85
New cards

Why IDs are INTEGER even though you don't do math on them

86
New cards

The DBMS may do math on them: auto increment adds 1 to the prior ID.

87
New cards

NOT NULL

88
New cards

Makes a field required. Leave it off only with a business reason (e.g., middle name, since not everyone has one).

89
New cards

Size on INTEGER

90
New cards

Don't specify one. INTEGER(4) is accepted but imposes no limit beyond the integer type's own size.

91
New cards

VARCHAR size in CREATE TABLE

92
New cards

A maximum. VARCHAR(35) accepts up to 35 characters and frees whatever isn't used.

93
New cards

CHAR size in CREATE TABLE

94
New cards

Exact. CHAR(2) requires exactly 2 characters.

95
New cards

Commas in CREATE TABLE

96
New cards

Every field definition ends with a comma, including the last one, since it must be separated from the constraints.

97
New cards

Primary key constraint syntax

98
New cards

CONSTRAINT customer_pk PRIMARY KEY (customer_id)

99
New cards

Constraint naming convention

100
New cards

tablename_constrainttype, e.g., customer_pk, orders_fk. Makes the system self-documenting.