Software Engineering › Flashcards › SQL questions
Flashcards for SQL questions
15 cards where the term can be tested as a sql question. Study these as flip cards Random
The kind of value a variable holds: character, string, Boolean, integer, real (single-precision floating point) and date/time. The type decides how much memory it uses and what operations are allowed.
Example: 'Age = integer; price = real; isMember = Boolean; name = string.'
Chooses the fields (columns) to return from a table: SELECT name, mark FROM students; SELECT * returns all columns.
Example: 'SELECT FirstName FROM Customer;'
Filters rows using conditions (=, <>, >, <, AND, OR). Text values need quotes. 2025 marker note: use quotes around searched text and combine conditions with AND or OR.
Example: "WHERE Suburb = 'Parramatta' AND Age > 18"
Sorts results by a field, ascending (ASC, the default) or descending (DESC).
Example: 'ORDER BY mark DESC'
Groups rows that share a value so aggregate functions (COUNT, SUM, AVG, MIN, MAX) can be applied to each group.
Example: 'SELECT class, COUNT(*) FROM students GROUP BY class;'
Functions that calculate one value from many rows: COUNT (number), SUM (total), AVG (mean), MIN and MAX.
Example: 'SELECT AVG(mark) FROM results;'
Combines rows from two or more tables by matching a primary key to a foreign key (INNER JOIN ... ON a.id = b.id).
Example: 'FROM Student JOIN Class ON Student.ClassID = Class.ClassID'
Gives a table or column a temporary name to make queries shorter and clearer: SELECT s.name AS student FROM Student AS s.
Example: 'FROM Student AS s JOIN Class AS c'
Check this one: Not found word-for-word in the supplied syllabus, specifications, marking guidelines or notes; the definition is standard computing knowledge, so check it against your class notes.
A primary key uniquely identifies each record in a table; a foreign key is a field that holds another table's primary key to link the tables.
Example: 'ClassID is the primary key of Class and a foreign key in Student.'
Create, Read, Update, Delete: the four basic database operations (INSERT, SELECT, UPDATE, DELETE).
Example: "UPDATE Student SET mark = 80 WHERE id = 3"
Where you would use it in the test- Multiple choice: Multiple choice: pick the option that matches the definition or example.
- SQL: SQL question: write or read it in the SQL query tool.
- Fill in the blanks: Fill in the blanks or dropdown: choose this term to complete a statement or table.
Memorise: SQL vs ORM
Check this one: From the school notes, not named in the syllabus.
SELECT fields FROM table WHERE criteria GROUP BY field ORDER BY field ASC or DESC; keyword AS renames a field for display.
Example: 'SELECT Name FROM Games WHERE Cost > 20 ORDER BY Name ASC'
Relational operators: CONTAINS, DOES NOT CONTAIN, EQUALS, NOT EQUAL TO, GREATER THAN (OR EQUAL TO), LESS THAN (OR EQUAL TO). Logical operators: AND, OR, NOT. Put text and dates in quotes.
Example: "WHERE Name CONTAINS 'war' AND Cost < 50"
SELECT Developer, SUM(Cost) AS Totalcost FROM Games GROUP BY Developer ORDER BY Developer DESC.
Example: 'SUM (Games.cost) AS Totalcost'
Make; build; put together items or arguments.
Example: 'Construct a SQL query.' Answer: build the diagram, query or code with every required feature.
Use SELECT, FROM, WHERE, GROUP BY, ORDER BY in order; put text in quotes; combine conditions with AND or OR; name the right tables.
Example: 2025 Q21.