Use Sakila; Select * from actor; Select first_name, last_name from actor; Select last_name, first_name from actor order by last_name; Select last_name, first_name from actor order by last_name Desc; Select * from Address; Select * from Address where district = 'California'; Select * from Customer; Select * from Customer where Create_date >'2006-02-14'; Select * from payment; Select rental_id, amount from payment where amount > 5; /*join tables */ Select first_name, Last_name, Address, district from customer inner join address on customer.address_id=address.address_id where district='California'; Select first_name, Last_name, Address, city, district from customer inner join address on customer.address_id=address.address_id inner join City on city.city_id = address.city_id where district='California'; /*insert new records */ Select * from store; Insert into customer(store_id, first_name, last_name, address_id, active, create_date, last_update) Values(1,'Jennifer', 'Juniper', 1,1, current_timestamp, current_timestamp); Select * from staff; Select * from customer; Insert into rental(rental_date, Inventory_id, Customer_id, staff_id, last_update) Values(current_timestamp, 100, 600, 2, current_timestamp); Select * from Rental ORDER by rental_id desc;
Monday, October 28, 2019
Intro to MySQL SQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment