WK4 SQL Queries: Basic queries Flashcards

1
Q

SELECT

A

SELECT indicates which columns to return.

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

FROM

A

FROM indicates which table to query.

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

We’re going to determine which computer has been assigned to a certain employee. Let’s say we have access to the employees table. The employees table has five columns. Two of them, employee_id and device_id, contain the information that we need. We’ll write a query to this table that returns only those two columns from the table.

select employee_id, device_id
from employees;

Suppose you wanted to know what department the employee using the computer is from, or their username, or the office they work in. To do that, we can use SQL to make another statement that prints out all of the columns from the table. We can do this by placing an asterisk after SELECT. This is commonly referred to as select all. Now, let’s run this query to the employees table in SQL. And now we have the full table in the output.

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

Syntax

A

Syntax refers to the rules that determine what is correctly structured in a computing language. In SQL, keywords are not case-sensitive

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