Section 11 - SQL & Client-Server Databases Flashcards
What is SQL?
Structured Query Language is a declarative language used for querying and updating tables in a relational database.
What is a declarative language?
A programming paradigm that expresses the logic of computation without describing its control flow
What is the SELECT statement?
A SQL statement that is used to extract a collection of fields from a given table
What is the syntax of a SELECT statement?
SELECT [the list of fields to be displayed]
FROM [the table/tables where the data will come from]
WHERE [the list of search criteria]
ORDER BY [list the fields that the results are to be sorted on]
What is the difference between CHAR(n) and VARCHAR(n)?
CHAR is a character strong of fixed length n, whilst VARCHAR is a character string of variable length, with the max length being n.
What is the INSERT statement?
A SQL statement that is used to insert a new record into a database table
What is the syntax for an INSERT statement?
INSERT INTO tableName (column1, column2, etc)
VALUES (value1, value2, etc)
What is the UPDATE statement?
A SQL statement that is used to update a record in a database table
What is the syntax for an UPDATE statement?
UPDATE tableName
SET column1 = value1, column2 = value2, …
WHERE columnX = value
What is the DELETE statement?
A SQL statement that is used to delete a record from a database taleb
What is the syntax for a DELETE statement?
DELETE from tableName
WHERE columnX = value
What is a wildcard?
Wildcards can be used in SQL commands to specify any possible value. For example, rather than selecting a specific attribute in a SELECT command, a wildcard could be used to return all attributes.
What is the syntax for a wildcard?
In SQL, wildcards are usually notated with an asterix
What is the CREATE command?
A command that creates a new database table. You must specify the name of the new table, its attributes and their data types. Additionally, entity identifiers are specified.
What are the different data types for SQL?
- CHAR(size)
- VARXHAR(size)
- INT(size)
- FLOAT(size, precision)
- DATE
- DATETIME
- TIME
- YEAR