Lesson 1 Flashcards

SELECT * FROM (7 cards)

1
Q

Every SQL query you write to pull data will use ____ and ____, which are ____.

A

Every SQL query you write to pull data will use SELECT and FROM, which are SQL clauses.

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

SQL is / is not case sensitive

A

SQL is NOT case sensitive

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

What is a database?

(preview for end of course)

A

A database is built up of a bunch of different tables that are related together in some way (usually connected with IDs using joins in SQL)

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

How can you write SQL code so you don’t look like a newbie?

__________________________

Why is this important?

Hint: everything on one line? Write code example and answer

A

Make sure you don’t type all your queries on one line like this:

SELECT * FROM orders

_______________________________________________________________

Instead:

  • Put everything on a new line
  • Indent everything that falls under each SQL clause
    • So that all the SQL clauses are all the way to the left
SELECT
    *
FROM
    orders
  • This will keep all your SQL queries nice and organized, and make it really easy for someone else to read
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you pull everything from the orders table?

(write code)

A
SELECT
    *
FROM
    orders
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you pull the order_id column from the orders table?

(write code)

A
SELECT
    order_id
FROM
    orders
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can you pull the order_id, customer_id, and product_name columns from the orders table?

(write code)

A
SELECT    
   order_id,     
   customer_id,     
   product_name 
FROM
   orders
How well did you know this?
1
Not at all
2
3
4
5
Perfectly