S
Q
L
S
Q
L
S
Q
L
S
Q
L
Select Statement

The SELECT statement is used to select data from a database. The data returned is stored in a result table, called the result-set.

SELECT *
FROM mydb.profession
WHERE profession = 'Manager';
SELECT prof_id AS ID
FROM mydb.profession
WHERE profession = 'Manager' AND prof_id = 6;

Joins

A JOIN clause is used to combine rows from two or more tables, based on a related column between them.

Select my_contacts.last_name, first_name, email, interests.interest From my_contacts Join contact_interest on my_contacts.contact_id = contact_interest.contact_id Join interests on contact_interest.interest_id = interests.interest_id Order by my_contacts.last_name;
Select count(status) as ‘total married’ from my_contacts Join status on my_contacts.status_id = status.status Where status = ‘married’;
select my_contacts.last_name, first_name, email, status.status, seeking.seeking from my_contacts join status on status.status_id = my_contacts.status_id join contact_interest on my_contacts.contact_id = contact_interest.contact_id join interests on interests.interest_id = contact_interest.interest_id join contact_seeking on my_contacts.contact_id = contact_seeking.contact_id where interests.interest = ‘fishing’ order by my_contacts.last_name;

Some of my Work


My SQL DataBase

Image

A SQL project working with UML diagrams, various queries and Foreign Key Checks.

VIEW

UML Diagram

Image

Creating a UML Diagram to link primary and foreign keys

VIEW