SQL Selcting Single Table Commands Flashcards

1
Q

What does the command SELCET do? and can you provide and example

A

It retrieves data from a database table

Example:

SELECT name,age
FROM users

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What doesnthe command FROM do?and give an example

A

It specifies the table that we need to retrieve data from
Example:
SELECT height, gender
FROM athletes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What dose the command WHERE do? And give and example

A

If filters the data based on a specific condition

Example:
SELECT * FROM users
WHERE age<30

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the command LIKE do?and give an example

A

Filters the data based on a specific pattern

Example:

SELECT * FROM users
WHERE name LIKE ‘J%’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the command AND do ?
And give an example

A

Combines multiple conditions in a WHERE clause

Example:

SELECT * FROM users
WHERE age > 18 AND city = ‘New York’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What dose the OR command do and give an example

A

Retrieves data when at least one of the conditions is true

Example:

SELECT * FROM users
WHERE age < 18 OR city = ‘New York’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are WILDCARDS and give an example

A

’ 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

  1. SELECT * FROM users WHERE name LIKE ‘J%’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly