L23 - SQL 1 Flashcards
1
Q
What is SQL?
A
- Main language for relational DBMS
- Declarative - specification on what you require
- Free format
- Consist of english words
- Used by a range of users
- 2 components
- Data Definition Language (DDL)
- Define DB structure
- Data Access Control
- Data Manipulation Language (DML)
- Retrieve and update data
- Data Definition Language (DDL)
2
Q
What is the objective of SQL?
A
- Database Language should
- Create database and table structure
- Basic operations - add, amend and remove
- Simple and complex queries
- Minimal user effort
- Portable to a recognised standard ISO
3
Q
How do you write SQL commands?
A
- Pool of reserved words + User defined words
- Reserved words (UPDATE, SELECT)
- Fixed part of SQL
- Spelling is required
- Cannot be split across lines
- User Defined Words
- Made up by the user
- Rep names of various database objects
- Tables, columns and views
- Reserved words (UPDATE, SELECT)
4
Q
What are literals?
A
- Used in SQL statements
- Non-numeric literals are enclosed in single quotes
- Numeric literals are not enclosed in quotes
5
Q
What is the SELECT statment?
A
6
Q
What is the NULL search condition?
A
7
Q
What are calculated fields?
A
8
Q
What is the WHERE calause
A
9
Q
What is pattern matching?
A
10
Q
How do you sort the result table?
A
- Usually rows are presented in no order
-
ORDER BY allows rows to be sorted
- By 1+ specified columns
- Use ASC or DESC keyword
- Add more minoring clause by adding a comma
11
Q
How do you use HAVING?
A
12
Q
Wha tis a modification statment?
A
- INSERT - adds new rows of data
- UPDATE - modifies existing data in a table
- DELETE - removes rows of data from a table
13
Q
What is the INSERT statment?
A
- Data to be inserted must be in order of the columns
- Must be compatible with the data type of corresponding column
14
Q
What is the UPDATE STATMENT?
A
15
Q
What is the DELETE statment?
A