Wednesday, February 12, 2020

CRUD Create Read Update Delete

SELECT * FROM <database>;

The * means = "Give me all the columns".

SELECT Expression: select the columns that you want.

SELECT name FROM cats;

Example:
SELECT name FROM cats;

SELECT name, age FROM cats;

SELECT cat_id, name, age FROM cats

//

CODE: Introduction to WHERE

Select by age:
SELECT * FROM cats WHERE age=4; 
Select by name:
SELECT * FROM cats WHERE name='Egg'; 
Notice how it deals with case:
SELECT * FROM cats WHERE name='egG'; 

//
CODE: Introduction to Aliases

No comments:

Post a Comment

Right Joins

-- OUR FIRST RIGHT JOIN (seems the same as a left join?) SELECT * FROM customers RIGHT JOIN orders     ON customers.id = orders.custom...