Browse all practice questions for the SQL Basics Practice Test. Search by topic, open any question and review its full explanation, then test yourself in the practice quiz.

SQL Basics Practice Test course image
More practice questions

These questions are part of the practice quiz. Start practicing

  • Which statement creates a simple view named recent_orders showing orders from the last 30 days?
  • SQL operator that returns true when the value is NULL and false otherwise
  • The three main stages of normalization are collectively known as what?
  • How do you sort employees by hire_date descending?
  • Which clause lists the tables that contain the fields in the SELECT clause?
  • Which aggregate function counts the number of non-null values in a column per group?
  • Which acronym represents the four properties of a database transaction?
  • Which term is a clause that indicates the column to edit?
  • How do you find products whose name starts with 'App'?
  • How do you concatenate first_name and last_name with a space in between?
  • Where is the DISTINCT qualifier placed in a SELECT statement?
  • Intermediate table to store a relationship where more than one row of T1 refers to more than one row of T2.
  • Which SQL statement removes the table named old_data from the database?
  • Which operator returns rows from the first query not present in the second query?
  • Which term describes a virtual table that presents data as a table but does not store its own data?
  • Which operator removes duplicates when combining results from two SELECT statements?
  • Operator that returns true if the value on the left is greater than or equal to the value on the right.
  • Which of the following creates a table with an inline primary key for id?
  • Which statement creates an index on orders(customer_id) with the name idx_orders_customer_id?
  • Which aggregate function returns the minimum value in a column, excluding NULLs?
  • Which qualifier returns only unique values in a result set?
  • Which data type stores fixed-length character values?
  • How do you select first_name and last_name from employees and alias the column last_name as surname in the result?
  • How do you return unique city values from a table customers?
  • What language defines the access rights to data?
  • Which concept defines the three boolean values SQL uses: TRUE, FALSE, and UNKNOWN?
  • A construct containing copies of original values and backreferences to their original rows. Not part of the SQL standard.
  • All queries begin with which command?
  • Which statement accurately describes First Normal Form as presented?
  • In DDL, how do you declare a column as the primary key?
  • Which keyword sorts values in descending order?
  • Which combination correctly starts a transaction and then commits it?
  • How do you count the number of orders per customer?
  • Which clause lists the fields that are not summarized in the SELECT clause when using aggregate functions?
  • How do you extract the year from a date column named order_date?
  • A data file that has no structured relationships between its records is known as a
  • In a relational table, what is the smallest unit of data?
  • What term refers to a special type of stored procedure that executes automatically in response to events and is associated with a specific table?
  • How do you find records where phone is not provided (NULL) in customers?
  • Which language retrieves and manipulates data (for example, SELECT, INSERT, DELETE)?
  • What term describes a property used to characterize data items of entities, such as datatype and size?
  • Which expression would you use to filter orders within the last 30 days relative to today?
  • Which statement creates an index on orders(customer_id) with the name idx_orders_customer_id?
  • How do you alias a table and a column in a SELECT?
  • How do you return orders with customer details using an inner join between orders and customers on customer_id?
  • A group of attributes describing the structure of entities is called what?
  • Which term refers to the name of the table the command is applied to?
  • In a JOIN, what clause specifies how rows from two tables are matched?
  • Which normal form eliminates partial dependency of non-key attributes on the primary key?
  • Which statement retrieves all columns from a table named orders?
  • What is the process of organizing data to minimize redundancy and remove ambiguity by separating a DB into tables and defining relationships?
  • Which data type stores both date and time?
  • How do you select a customer's total orders using a scalar subquery in the SELECT list?
  • Which query returns customers whose average order amount exceeds 100?
  • Which SQL statement creates a new table?
  • A language element which specifies a non arithmetic condition Ex. [NOT] IN, [NOT] LIKE
  • In a many-to-many relationship, the rows of the junction table contain the primary keys of T1 and T2 as values.
  • Which clause is used to filter groups after a GROUP BY based on a condition on aggregates?
  • When using UNION to combine two SELECT statements, which condition must hold?
  • Which operation returns only rows that appear in both result sets?
  • Which property ensures that a transaction is fully completed or fully rolled back?
  • Which aggregate function calculates the average value?
  • Which data type stores fixed-length character values?
  • In the numeral system using digits 0-9 and letters A-F, which system is described?
  • Which syntax assigns an alias to a table in the FROM clause?
  • Which clause is used to filter rows in query results?
  • Write a query to fetch all orders with status = 'shipped'.
  • Operator that returns true if the value on the left is larger than the value on the right.
  • In the time format HH:MM:SS[.sf], what does the part in brackets represent?
  • How do you replace NULL with a default value for a column in a SELECT?
  • Which operator would you use to compute the total numeric value of a column, ignoring NULLs?
  • Which principle states that completed transactions should remain stable/permanent even during system failure?
  • How do you include all customers and their orders, even if a customer has none?
  • Which operation is used to retrieve data by listing the fields to include?
  • Which term refers to a keyword that represents an action or modifies an action, typically a verb or adverb?
  • Which operation changes the structure of an existing table?
  • Which normal form is defined as No duplicate information permitted; if two tables require a common field, that common field's information should be separated into a different table?
  • What term refers to a virtual table defined by a query that references real tables?
  • What term describes a name used to identify a database object, such as a field?
  • How do you cast a string date '2020-01-01' to a DATE type?
  • Which statement describes INNER JOIN behavior?
  • What is the database system catalog that stores metadata about tables, views, and constraints?
  • What is the difference between COUNT(*) and COUNT(column_name) when counting rows with NULLs?
  • Which concept refers to a group of SQL statements that are treated as a single unit of work, which either all succeed or fail?
  • What term describes an expression that evaluates to true or false?
  • What term describes a set of rows of a certain entity-type, i.e., all rows share the same structure?
  • Which clause sets a default value for a column named status to 'active'?
  • What is the purpose of the CAST function?
  • Which aggregate function returns the count of a column and includes NULL values when used with an asterisk?
  • Used to temporarily rename a column or a column heading.
  • What is the effect of ORDER BY hire_date DESC in a query?
  • What format is described by 'YYYY-MM-DD' for dates?
  • Which statement would count the number of orders per customer using a GROUP BY clause?
  • In 1NF, which property describes the indivisibility of each value in a column?
  • Which statement describes a scalar subquery in the SELECT clause?
  • What is the primary goal of normalization in a relational database?
  • Which operator returns distinct results when combining two result sets?
  • Which SQL statement changes an existing table?
  • NULL is an example of which type of value that does not change?
  • Which database object points to a currently selected set of records and can be acted on as a group in many languages?
  • Which construct describes a non arithmetic condition such as NOT IN or NOT LIKE?
  • How do you declare a foreign key referencing another_table(id)?
  • Which SQL statement edits a row in a table?
  • In relational database terminology, a value that does not change, such as a number or NULL, is called a ...
  • Which identifier denotes descending order in a sort operation?
  • Which term describes a reference between two entities that depends on the values of the entities?
  • Which statement creates a table named products with id as integer primary key and name as varchar(100) not null?
  • Which SQL statement adds a new row to a table?
  • How do you filter groups to those with more than 5 orders?
  • In some SQL dialects, how can you handle NULL-safe equality checks in predicates?
  • Which language defines the logical and physical design of a database (for example, CREATE TABLE)?
  • Which symbol denotes a single-line comment in SQL-like syntax?
  • Is the data type for a column that indicates text
  • Which statement counts only non-null values in a column?
  • A block whose content has changed memory, but is still not written to disk.
  • Which data type is used to store strings with a specified maximum length?
  • What term describes a single record in a table with exactly one value for each column?
  • How do you check if a customer has any orders using EXISTS?
  • In storage terms, what is a mass storage structure that contains rows or tables called?
  • Which operator returns true if the values on either side are not equal to each other?
  • How do you select rows where country is one of 'USA', 'Canada', or 'UK'?
  • Which notation denotes a multi-line comment?
  • Which query includes all orders and their customers, even if an order has no customer (rare scenario)?
  • Which property ensures that concurrent transactions do not interfere with each other?
  • How do you add a new column email VARCHAR(255) to a table users?
  • Which term describes a fast-access structure that holds copies of original values and is not part of the SQL standard?
  • Which clause or keyword is used to provide the list of values to insert into a table?
  • Operator that returns true if the value on the left is smaller than the value on the right.
  • Which sequence begins a transaction and then commits it?
  • What is the term for a single data item located at the intersection of a row and a column?
  • What is the primary idea of First Normal Form (1NF) in relational databases?
  • What is the virtual table that contains only its definition and no real data, defined by a query over real tables?
  • Which clause returns unique values for a column in a SELECT statement?
  • What term describes a group of SQL statements that are executed as a single atomic unit?
  • Which aggregate function returns the sum of values in a numeric column, excluding NULLs?
  • A reference between two different or the same entity. Based upon the values of the entities.
  • Which clause specifies how to sort the results of a query?
  • Which query structure returns rows from customers where the id appears in the customer_id column of orders?
  • Which aggregate function returns the maximum value in a column, excluding NULLs?
  • Which data type is used to store binary data?
  • In SQL, which concept allows you to assign a temporary name to a column or expression in a query?
  • Which SQL statement queries data from a table?
  • What is the term for a combination of identifiers, operators, constants and functions that evaluates to a single value?
  • Which function returns the current date in many SQL dialects?
  • Is a clause that lets you add a new column to a table.
  • What is a common block comment notation used in many programming languages?
  • What are the three main stages of normalization collectively called?
  • Which term is a clause that indicates the data being inserted?
  • Which operator would you use to compute the maximum numeric value in a column, ignoring NULLs?
  • What is a correlated subquery?
  • Which time format includes an optional fractional part?
  • Which pattern returns customers whose id matches any customer_id in orders?
  • In the hexadecimal number system, which characters are used to represent values 10-15?
  • Which SQL statement deletes rows from a table? (Is a clause)
  • Which statement removes all rows from the table old_data but keeps the table structure?
  • Which term describes a constraint that holds a unique value identifying each record and may be composed of multiple fields?
  • Which operator checks for NULL values in a condition?
  • Which term refers to a data file with no relational structure among its records?
  • Which qualifier returns all values by default?
  • Which aggregate function returns the average value for a numeric column, excluding NULLs?
  • Which operator checks if the left value is less than or equal to the right?
  • Which data type would you use to store text in a column?
  • A combination of operands and operators that yields a value for use in a query is called a
  • Which SQL operator tests for the existence of rows returned by a subquery?
  • Which term describes the fundamental unit of data that characterizes an entity, such as its datatype and size?
  • Which data type stores variable-length character values?
  • Which ACID property ensures that a transaction is all-or-nothing?
  • Which query selects records from tickets where (status = 'open' AND priority = 'high') OR (status = 'new')?
  • Which term describes a relationship or connection between two entities that can be a part of data modeling and is based on the values of the entities?
  • In a database, which concept represents a single row within a table?
  • In SQL, a language element that is part of a statement is called a
  • Operator that returns true if the value on the left is less than or equal to the value on the right.
  • Which operator returns true if the values on either side are equal to each other?
  • Which data type is used to store binary data?
  • How do you return only the first 10 rows from a query in PostgreSQL/MySQL?
  • Which term is a special stored procedure that automatically runs in response to events on a table?
  • Which operator lets you combine two SELECT statements into one, requiring the same number of output fields in the same order?
  • Which mechanism allows rows of a table to be acted on at one time?
  • Which SQL command would you issue to revert all uncommitted changes in the current transaction?
  • Which syntax limits the number of rows to 10 in PostgreSQL/MySQL?
  • Which description best defines a correlated subquery?
  • Which construct defines higher-level rules for data items, including nullability and keys?
  • Which clause imposes conditions on the fields that are summarized in the SELECT statement?
  • Which operator compares if the left value is greater than or equal to the right?
  • Which term describes a key field that identifies records in a table by matching a primary key in a different table?
  • What is the result of a CROSS JOIN between two tables?
  • Which SQL statement retrieves all columns from a table named customers?
  • How do you get sales between 100 and 500 inclusive?
  • In a relational database, a complete set of information presented in a table, with each row representing a single item, is called a
  • Which operator checks for inequality (not equal) between two values?
  • What does RDMS stand for?
  • Which SQL command cancels the proposed changes in a pending transaction and marks the end of the transaction?
  • Which property ensures transitions from one valid state to another valid state?
  • Which data type stores only the time of day without a date?
  • How do you ensure a column cannot contain NULL values at creation time?
  • Which data type is used to store date values in the format year-month-day?
  • Which keyword is used to define a default value for a column in a DDL statement?
  • Which constraint enforces referential integrity by linking a column to a primary key in another table?
  • Which statement fragment is used to add a new column to an existing table?
  • Which clause specifies field criteria that must be met by each record to be included in the results?
  • How do you get the length of a string in many SQL dialects?
  • Which data type stores variable-length character values?
  • An identifiable object like employee or department is an instance of which type?
  • Which SQL command marks the finalization of a database transaction?
  • Which database concept holds a unique value identifying each record and can be composed of multiple fields?
  • Which CASE expression assigns 'high' for score > 80, 'medium' for >=50, else 'low'?
  • Which is the correct syntax to modify an existing table by adding a new column?
  • Which operation adds a new row to a table?
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy