Monday, November 21, 2016

MySQL SQL Morning

Use Sakila;
show tables;
Select * from Customer;

Select * from Actor;
Select * from Film;
Select * from film_actor;

Create view artist_films
As
Select first_name, Last_name, title, release_year
From actor
inner join film_Actor
on actor.Actor_Id = film_actor.actor_id
inner join film
on film.Film_id = film_actor.Film_id;

Select * from artist_films
where title = 'Academy Dinosaur';

Insert into Actor(first_name, last_name)
values('Joe','Smith'),
('Mark', 'Jones'),
('Thomas', 'Tankengine');

Insert into film_actor(actor_id, film_id)
values(201,1);

Update actor
Set Last_name = 'Smithers',
first_name='Joseph'
Where actor_id = 201;

Start transaction;
commit;

Select * from Actor;

Start Transaction;
Update actor
Set Last_name = 'Smithers',
first_name='Joseph';


use sakila;

select * from author;


No comments:

Post a Comment