EECS 3421 Second Half

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

1/23

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:52 PM on 4/7/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

24 Terms

1
New cards

What does SQL stand for

Structured Query Language

2
New cards

What is SQL

Developed by IBM

A standard query language for relational database access

can be used by most RDBMS tools such as IBM DB2…

3
New cards

SQL Commands

• Data Definition Language (DDL)

• Data Manipulation Language (DML)

• Data Control Language (DCL)

• Transaction Control Language (TCL)

4
New cards

Data Definition Language (DDL)

  • Set of commands to create and modify the structure of database objects (e.g., tables, views, schemas, indexes, etc.)

  • goal is to enable the implementation of the relational schema as an actual relational database

  • Example commands: CREATE, ALTER, DROP

  • Schema is the logical definition of a database (it defines table name, column names, data types, etc.)

5
New cards

Data Definition Language (DDL) Example

knowt flashcard image
6
New cards

SQL Data Types

  • Numeric - int, numeric, float

  • String - char, varchar, text

  • Date amd time - date, datetime

7
New cards

Data Manipulation Language (DML)

used to insert, modify, delete, and retrieve data.

  • Primary DML Commands:

    • SELECT

    • INSERT

    • UPDATE

    • DELETE

8
New cards

Data Manipulation Language (DML) Example

select Staff_Name, Salary

from Staff

where Salary > 15000;

n insert into Staff

(Staff_ID, Staff_Name, DeptNumb, Salary)

values (510, ‘Harrison’, ‘D38’, 15400);

n update Staff

set Salary = Salary * 1.15

where Staff_ID = 510;

n delete from Staff

where Staff_ID = 540;

9
New cards

SELECT

specifies the attributes to be returned by the query

10
New cards

SELECT DISTINCT

show one instance of all the different values of the selected attributes in the relation.

11
New cards

FROM

specifies the table(s) from which the data will be retrieved

12
New cards

ORDER BY

sorts the final query result rows in order based on the values of one or more ascending or descending attributes

13
New cards

WHERE

filters the rows of data based on provided criteria

14
New cards

Operations:

Arithmetic operators:

+ - * /

Comparison operators:

= > >= <= <>

Boolean operators:

AND OR NOT IN BETWEEN LIKE

15
New cards

GROUP BY

groups the rows of data into collections based on sharing the same values in one or more attributes

16
New cards

HAVING

filters the groups formed in the GROUP BY clause based on provided criteria (i.e., determines which groups will be displayed in the result).

17
New cards

JOIN

Combines data from two relations based on values for a common attribute

18
New cards

INNER JOIN Vs OUTERJOIN

  • INNER JOIN (not allow null in join fields: if missing,

drop)

  • OUTER JOIN (allow null in join fields)

    • LEFT OUTER JOIN (include all records in left join table course) --- include courses that do not have an instructor

    • RIGHT OUTER JOIN (include all records in right join table instructor) --- include instructors that do not teach any course

    • FULL OUTER JOIN (include all records in course and instructor tables)

19
New cards

ANY

ANY returns true if any of the subquery values meet the condition.

  • Example: List employees who work in EASTERN division

SELECT STAFF_NAME, STAFF_ID

FROM STAFF

WHERE DEPTNUMB = ANY

(SELECT DEPTNUMB FROM ORG WHERE DIVISION = ‘EASTERN’)

20
New cards

ALL

  • returns true if all of the subquery values meet the

condition.

  • Example: Find the department with highest average salary

SELECT DEPTNUMB, AVG(SALARY)

FROM STAFF

GROUP BY DEPTNUMB

HAVING AVG(SALARY) >= ALL

(SELECT AVG(SALARY) FROM STAFF GROUP BY DEPTNUMB)

21
New cards
22
New cards
23
New cards
24
New cards