SQL - Basics Flashcards
The very basics of SQL.
What does SQL stand for?
Structured Query Language.
What is SQL used for?
To communicate with databases.
Which statement is used to select a column?
SELECT
.
Which statement is used to choose the table?
FROM
.
Which statement is used to filter data?
WHERE
.
What is the basic order of an SQL query?
SELECT
, FROM
, WHERE
.
How do you select the ‘first_name’ column from a table called ‘customer_name’?
SELECT first_name
FROM customer_name;
How do you select multiple columns?
Separate column names with commas.
How do you select ‘customer_id’ and ‘first_name’ from ‘customer_name’?
SELECT customer_id, first_name
FROM customer_name;
How do you filter results by a condition?
Use WHERE
.
How do you select customers with first_name ‘Tony’?
SELECT first_name
FROM customer_name
WHERE first_name = ‘Tony’;
How do you add more than one condition in a query?
Use AND
or OR
.
How do you filter results where a value is greater than a number?
Use >
in the WHERE
clause.
How do you write a comment in SQL?
Use --
for single-line comments.
Are SQL keywords case-sensitive?
No, they are not case-sensitive.