SQL Basics - 2 Flashcards
More basic SQL lessons.
Why should you use capitalization and indentation in SQL?
To make your queries easier to read and troubleshoot.
What does a semicolon do at the end of a SQL statement?
It terminates the statement (part of the ANSI SQL-92 standard).
Does every SQL database require a semicolon at the end of a statement?
No, not all databases enforce the semicolon.
What does the WHERE
clause do in SQL?
It narrows the query to return data that meets specific conditions.
What is the percent sign %
used for in a SQL query?
It is a wildcard to match one or more characters. Example: WHERE field1 LIKE ‘Ch%’;
What happens if you use SELECT *
in a query?
It selects all columns in the table.
Why should you be cautious using SELECT *
?
It can select too much data, slowing down the query.
How do you add a comment in SQL?
Use --
for single-line comments or /* */
for multi-line comments.
What is the purpose of comments in SQL?
To describe the query and help others understand it.
What does <>
mean in SQL?
“Does not equal.”
Why is SQL powerful for a data analyst?
It enables quick access to data for insights and decision-making.