![]() |
Created by Malachy Moran-Tun
almost 3 years ago
|
|
![]() |
Copied by Malachy Moran-Tun
almost 3 years ago
|
|
Question | Answer |
What is SQL? | > Structured Query Language > Declaritave language used for updating tables in a relational database > Uses statements to make, query, and modify databases |
What do the Following Commands do? > SELECT > FROM > WHERE > ORDER BY | > SELECT - lists the fields to be displayed > FROM - lists the table(s) where data will be read from > WHERE - lists data that matches the criteria > ORDER BY - orders the results (default is ascending order) |
How does the LIKE Command Work? | > Condition that finds values with a wildcard > LIKE "a%" finds values that begin with a > LIKE "%a" finds values that end with a > LIKE "%a%" finds values with a in any position > LIKE "_a%" finds values with a in second position (more underscores = higher position) > LIKE "a%b" finds values that begin with a and and with b |
What does the JOIN Command do? | > Combines rows from two or more tables, based on a common field between them |
How does the CREATE TABLE Command Work? | CREATE TABLE table_name ( Attribute1 DATA_TYPE, PRIMARY KEY Attribute2 DATA_TYPE etc. ) For linked tables: FOREIGN KEY Attribute3 REFERENCES OtherTable(Attribute3) |
What Data Types can be used when Creating a Table? | > CHAR(n) - string of fixed length n > VARCHAR(n) - string of variable length, max n > BOOLEAN - true or false, i mean you should know that one > INTEGER / INT - ... an integer, what did you expect? > FLOAT - a decimal (real) number > DATE - a... a date. y'know, day, month year > TIME - like hours, minutes, and seconds... it's pretty self explanatory > CURRENCY - le cash money |
How does the ALTER TABLE Command Work? | > Used to add, delete, or modify columns > ALTER TABLE table_name ADD attribute_name - adds the specified attribute > ALTER TABLE table_name DROP COLUMN attribute_name - removes the specified attribute > ALTER TABLE table_name MODIFY COLUMN attribute_name DATA_TYPE - changes the data type of the attribute |
How does the INSERT INTO Command Work? | > Used to insert a new record into a table INSERT INTO table_name (column1, column2...) VALUES (value1, value2...) > If attributes are unknown, do not list them in the columns or values |
How does the UPDATE Command Work? | > Used to update a record in a database table UPDATE table_name SET column1 = value1, etc. WHERE attribute = value |
How does the DELETE Command Work? | > it deletes a record. who'd've thunk it? DELETE FROM table_name WHERE attribute = value |
There are no comments, be the first and leave one below:
Want to create your own Flashcards for free with GoConqr? Learn more.