Online Coding Lessons SQL and Database Basics 1 — Questions and Answers
Question 1: What does SQL stand for?
- Structured Query Language (Correct answer)
- Simple Question Language
- Standard Query List
- Scripted Query Logic
Correct answer: Structured Query Language
SQL stands for Structured Query Language, which is used to communicate with and manipulate databases.
Question 2: Which SQL command is used to retrieve data from a database table?
- GET
- FETCH
- SELECT (Correct answer)
- PULL
Correct answer: SELECT
The SELECT command is the standard SQL statement used to query and retrieve data from one or more tables.
Question 3: What keyword is used in SQL to filter rows returned by a SELECT query?
- FILTER
- WHERE (Correct answer)
- HAVING
- LIMIT
Correct answer: WHERE
The WHERE clause is used to specify conditions that rows must meet to be included in the query results.
Question 4: Which SQL command adds a new row of data to a table?
- ADD
- APPEND
- INSERT INTO (Correct answer)
- UPDATE
Correct answer: INSERT INTO
INSERT INTO is the SQL command used to add new records (rows) into a database table.
Question 5: In a database table, what is a primary key?
- The first column in every table
- A column that uniquely identifies each row (Correct answer)
- The most important data in a row
- A password that locks the table
Correct answer: A column that uniquely identifies each row
A primary key is a column (or combination of columns) whose values uniquely identify every row in a table.
Question 6: Which SQL command is used to remove rows from a table?
- REMOVE
- DROP
- DELETE (Correct answer)
- CLEAR
Correct answer: DELETE
The DELETE statement removes one or more rows from a table based on an optional WHERE condition.
Question 7: What does the ORDER BY clause do in a SQL query?
- Filters duplicate rows from results
- Sorts the result set by one or more columns (Correct answer)
- Groups rows that have the same values
- Limits the number of rows returned
Correct answer: Sorts the result set by one or more columns
ORDER BY sorts the rows in the result set in ascending (ASC) or descending (DESC) order based on specified columns.
What does SQL stand for?