Database Design and Development (Implementation) Flashcards
What does SQL stand for?
Structured Query Language
In SQL, what is used to mean “all”?
- (asterisk)
What command is used to search a database for information generally?
SELECT field(s) FROM table(s);
eg SELECT firstName FROM pupils
What command is used to search a database for more refined information?
SELECT field(s) FROM table(s) WHERE field = description;
eg. SELECT firstName FROM pupils
WHERE firstName = “Darren”;
What syntax is used to search a database of more than one condition?
AND / OR / NOT
eg. SELECT firstName FROM pupils
WHERE firstName = “Darren” OR firstName = “Ian”;
What syntax is used to search a database of numbers between two extremes?
< / > / = / <= / >=
eg. SELECT firstName FROM pupils
WHERE age > 9
What are the two ways of ordering fields in a database and what is their syntax in SQL?
Ascending / ASC (Orders a field from lowest to highest)
Descending / DESC (Orders a field from highest to lowest)
What command is used to order a database?
SELECT feild(s) FROM table ORDER BY field (ASC / DESC)
eg. SELECT firstName FROM pupils
ORDER BY firstName ASC
What is the maximum number of fields a database can be ordered by?
2
What command is used to add information to a database?
INSERT INTO table
VALUES (new values in order with commas separating them)
eg. INSERT INTO pupil
VALUES (077868, Darren, O’Hare, Maths, 15)
What command is used to add information to a database if we only want to add information to specific fields?
INSERT INTO table
VALUES (new value, new value, new value)
eg. INSERT INTO pupil
VALUES (077868, Darren, Maths)
What command is used to rectify incorrect information of a database?
UPDATE table
SET field = “new value”
WHERE field = “old value”
eg. UPDATE pupil
SET firstName = “Adam”
WHERE firstName = “Darren”