Wednesday, February 21, 2018

MtSQL SQL 1:00 Class

Use PythonClubb;

Select * from Location;

Select RoomName, StreetAddress, City, State,PresentationDate, PresentationTime, Topic
From Location
join Presentation
on Location.idLocation = Presentation.Location_idLocation;

Select FirstName,Lastname, MeetingDate,MeetingTime, Topic
From Person
join member
on person.idPerson=member.Person_idPerson
join meetingattendance
on member.idMember=meetingattendance.Member_idMember
join meeting
on meeting.idMeeting=meetingattendance.Meeting_idMeeting
Where idmeeting=2;

Insert into Person(FirstName, Lastname, Email)
Values('Steve', 'Conger', 'Steve.conger@gmail.com');

Select * From Person;

Insert into Member(Person_idPerson, JoinDate)
Values(11,current_date());


Select * from Member;

/*Updates change existing records
where inserts new records
You should always use a where clause
with the key*/

Update person
set Lastname='Wrong',
Email ='John.Wrong@gmail.com'
where idPerson=1;

start transaction;
Update person
set LastName='Smith'
Where idPerson > 0;


Rollback;
Commit;

Delete from member where Person_idperson=11;
Delete from Person where idPerson=11;

Drop Table Presentation

No comments:

Post a Comment