DIFFERENT STRUCTURES IN DB Flashcards

1
Q

DDL - Data Definition Language
Standard for commands that define the different structures in a database.

CREATE : Table, Size, Data Types
MODIFY : Alter Table - Name, Column, Data Type
DROP Table, View (can’t roll back)
REMOVE DB objects such as Tables, Indexes and User

CREATE
ALTER
DROP

A
DML - Data Manipulate Language
Use to work with data
ADD. MODIFY. UPDATE. QUERY
1. Select - Retrieve records from 1+ tables
2. Insert - Create
3. Update - Modify
4. Delete - Remove
5. Trigger - Instead, After
———————————
DCL - Data Control Language 
Use to control access to data
Store in DB GRANT, REVOKE
1. Grant - Privilege to user
2. Revoke - Removes Privileges

NULL = ‘Unavailable’,’Unassigned’. Not same as 0 or blank.

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

DDL

A

Data Definition Language

Standard for commands that define the different structures in a database.

CREATE : Table, Size, Data Types
MODIFY : Alter Table - Name, Column, Data Type
DROP Table, View (can’t roll back)
REMOVE DB objects such as Tables, Indexes and User

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

DDL COMMANDS

A
  1. Create Command
    Trigger, Drop, Create, Alter
  2. Alter Table
    Modify Table, Name, Column, Data Types
  3. Drop Table
    Table, View, can’t rollback
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

DML

A

Data Manipulation Language

Work with Data

Use to work with data
ADD. MODIFY. UPDATE. QUERY

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

DML Commands

A
1. Select
    Retrieves records from 1+ tables
2. Insert - Create
3. Update - Modify
4. Delete - Remove
5. Trigger - Instead, After
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

DCL

A

Data Control Language

Controls Access

Use to control access to data
Store in DB GRANT, REVOKE

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

DCL Commands

A
  1. Grant - Privilege to user.

2. Revoke - Removes Privileges

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

NULL

A

Unavailable
Unassigned

Not same as 0 or Blank

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

Examples of

DML Command Insert

A

Insert Into table-name(col 1, col 2)
Values(value 1, value 2);

————
Insert data from 1 table to another

Insert Into table-name
Select * from another-table : columns have to match

————-
Select from columns

Insert Into table-name (col 1, col 2)
Select (col 1, col 2) from another-table;

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

Examples of

DML Command Modify

A

Modify

UPDATE table-name
SET Col1 = value
WHERE condition;

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

Examples of

DML Command DELETE

A

DELETE

DELETE FROM table-name
WHERE condition;

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

Examples of

DML Command MERGE

A

MERGE - combine data from multiple tables

MERGE INTO Table 1 USING Table 2
ON (condition) WHEN MATCHED THEN
UPDATE SET 
Col 1 = Value 1,
Col 2 = Value 2
WHEN NOT MATCHED THEN 
INSERT (C1,C2)
VALUES (V1,V2);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly