Essential Question: How can I use SQL to create a simple query?
Mastery Objectives:
SWBAT create a SQL database.
SWBAT add a record to a SQL database.
SWBAT delete a record in a SQL database.
SWBAT query a SQL database.
Do Now: Play the following vocabulary games to help learn the vocabulary words in SQL.
http://www.quia.com/jg/3175059.html - SQL Java Games
http://www.quia.com/ba/869727.html - SQL Battleship
http://www.quia.com/cm/791579.html - SQL Columns
http://www.quia.com/hm/1099820.html - SQL Hangman
Directions: Open a blank google doc. Complete the assignment in google docs. Take screen shots of your code and paste them into google docs. To create a screen shot on a chromebook, click on CTRL and the button that looks like a square with two lines to the right of it. To paste, click CTRL + V
Assignment : Watch the video: https://www.youtube.com/watch?v=27axs9dO7AE and write down 3 things that you learned in google docs. Read through this page https://www.w3schools.com/sql/sql_intro.asp and make a list of all the information on the page that was mentioned in the video.
Try the first example on the page: https://www.w3schools.com/sql/sql_intro.asp
Type the following codes and write what happens in a google doc:
SELECT * FROM Customers;
SELECT City FROM Customers;
SELECT City, Country FROM Customers;
SELECT customername, contactname FROM Customers;
Create your own line of code and describe what is displayed.
The 'DISTINCT' code, what does it do? Type these codes and try it out. Record your findings in google docs. https://www.w3schools.com/sql/sql_distinct.asp
SELECT Country FROM Customers;
SELECT DISTINCT Country FROM Customers;
SELECT City FROM Customers;
SELECT DISTINCT City FROM Customers;
Vocabulary
Table - a data structure that organizes information into rows and columns. It can be used to both store and display data in a structured format.
Query - a request for data or information from a database table or combination of tables.
Field - are the containers that store pieces of information or data in database tables
Record - Data is stored in records. A record is composed of fields and contains all the data about one particular person, company, or item in a database.
Relationship - is a situation that exists between two relational database tables when one table has a foreign key that references the primary key of the other table.
ERD - An entity relationship diagram (ERD), also known as an entity relationship model, is a graphical representation that depicts relationships among tables within a database.
SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index