SQL Selcting Single Table Commands Flashcards
What does the command SELCET do? and can you provide and example
It retrieves data from a database table
Example:
SELECT name,age
FROM users
What doesnthe command FROM do?and give an example
It specifies the table that we need to retrieve data from
Example:
SELECT height, gender
FROM athletes
What dose the command WHERE do? And give and example
If filters the data based on a specific condition
Example:
SELECT * FROM users
WHERE age<30
What does the command LIKE do?and give an example
Filters the data based on a specific pattern
Example:
SELECT * FROM users
WHERE name LIKE ‘J%’
What does the command AND do ?
And give an example
Combines multiple conditions in a WHERE clause
Example:
SELECT * FROM users
WHERE age > 18 AND city = ‘New York’
What dose the OR command do and give an example
Retrieves data when at least one of the conditions is true
Example:
SELECT * FROM users
WHERE age < 18 OR city = ‘New York’
What are WILDCARDS and give an example
‘’ and ‘%’ symbols are used for searching and matching data
‘’ used to select all columns in a table
‘%’ used as a wildcard character in the LIKE operator
Examples :
1. SELECT * FROM users
- SELECT * FROM users WHERE name LIKE ‘J%’