SQL Flashcards
SQL
Structured Query Language
DDL
Data Definition Language
-AutoCommit-
CRUD
Create
Read
Update
Delete
DDL Commands
Create
Alter
Drop
Truncate
DML
Data Manipulation Language
-NotAutoCommit-
DML Commands
Insert
Update
Delete
DQL
Data Query Language
DQL Commands
Select
DCL
Data Control Language
-Controls who can see data-
DCL Commands
Grant
Revoke
TCL
Transaction Control Language
TCL Commands
Commit
Savepoint
Rollback
Functions (Built-in)
Scalar
Aggregate
Scalar Function
returns a single row for every row queried in a table or row
Aggregate Function
returns a single result or set for a group of rows/tables
Query Makeup
SELECT (column list) FROM (table list) WHERE (condition1) AND (condition2) GROUP BY (column list) HAVING (condition) ORDER BY (default(ie assending) or DESC)
ResultSet
Table of results returned by execution of a SQL Query
Sub-queries types
Correlated
non-correlated
Correlated Sub-Query
Inner Query is not independent
Non-Correlated Sub-Query
Inner Query is independent
Sub-Query
Nested query in a query
Joins
Returns a resultset of two or more combined tables
Classifications of Joins
equi (=)
theta (,!=)
Types of Joins
Inner Right/Left Full Outer Cross Self
Inner Join
Return only rows that match
Right/Left Join
All from the directions side, only matches from the other side
Full Outer Join
Returns rows from all tables
Cross Join
Cartesian product
Self Join
Joins a table with itself
Set-Ops
Used for comparing result sets, NOT tables
Properties of a Database (ACID)
Atomicity
Consistency
Isolation
Durability
Set-Op Commands
UNION ALL
UNION
INTERSECT
MINUS
Dirty read
Returns something from a table/column that has not been committed
Non-Repeatable Read
Row is edited after being viewed
Phantom Read
Query that does not yield the same result when viewed again
Sequences
Stores and tracks a number that can be incremented/decremented
View
Essentially a saved SELECT query
Index
Speeds up searches by enforcing an in-memory order of rows
Trigger
Event listener in database
Function
Block of Code we can execute
Stored Procedure
Cannot produce a resultset
Used in java
Cursor
View stored in local variable
Prepared Statement
Pre-compiled statement
Callable Statement
Used to call a stored procedure