Term Glossary (Topic 1.3) Flashcards
Explain ‘Sequence Programming’ when referring to programming
The computer runs code in the order it is written.
Explain ‘Selection’ when referring to programming
The computer runs different pieces of code according to a condition being met (normally achieved using IF, CASE or SWITCH statements (depending on the programming language you are using))
Explain what the ‘CASE’ function achieves in SQL
Used to conditionally fill columns (used with WHEN and THEN).
Explain what the ‘DATETIME’ function achieves in SQL
A datatype used to store date and time data in standard format.
Explain what the ‘CAST’ function achieves in SQL
Similar to CONVERT – Changes the data type of a value. This is an example of EXPLICIT data type conversion.
Name the six types of JOINS in SQL
1) Inner
2) Outer
3) Left
4) Right
5) Anti
6) Cross
Describe an Inner Join
Tables A and B joined with matching rows (according to their key fields). Only rows with key values present in both tables are shown.
Describe an Outer Join
Tables A and B joined with matching rows (according to their key fields). Rows with key values present in either one of or both tables are shown.
Describe a Left Join
Tables A and B joined with matching rows (according to their key fields). Rows with key values present in the Left table are shown with any matching rows from the right table.
Describe a Right Join
Tables A and B joined with matching rows (according to their key fields). Rows with key values present in the Right table are shown with any matching rows from the left table.
Describe an Anti Join
Rows are shown that are present (according to a key value) in one table but not in another. In SQL, there is no ‘ANTI’ statement for this join. Instead you must perform a standard join and filter the resulting table using ISNULL.
Describe a Cross Join
All combinations of key values from both tables are shown, regardless of whether those combinations occurred in the database.
What will occur if a Join is performed on tables with duplicate rows
If there are duplicate values, a join will replicate them in the resulting table – providing these values match with the other table.
How would a Join need to be adjusted if the tables have multiple fields?
You can join tables using more than one key field with the ON statement.
State the four types of ‘Unions’ in SQL
1) Union
2) Union All
3) Except
4) Intercept