Essential Question: How can I insert data into a SQL database?
Mastery Objectives:
SWBAT insert data into a SQL database by field.
SWBAT insert data into a SQL database by order.
SWBAT insert data into a SQL database using an auto-incremented field.
Resources: https://www.youtube.com/watch?v=g4a7_HH9Wbg - What do programmers actually do?
Directions: Insert the following commands into the SQL editor https://www.w3schools.com/sql/trysql.asp?filename=trysql_insert_colname to add data to the database. Take a screenshot of your results and insert them into a google doc. Write a description underneath the screenshot describing your results. The commands add data to a SQL table using two techniques, one technique puts it into specific fields, the other puts the data in the order that the fields appear in the table so you need to get the order correct. The format for inserting into specific fields is:
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
The format for inserting data by order is:
INSERT INTO table_name
VALUES (value1, value2, value3, ...);
You don't need to add CustomerID because CustomerID is an auto-incremented field meaning it generates another number on its own.
INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country) VALUES ('Cardinal','Tom B. Erichsen','Skagen 21','Stavanger','4006','Norway');
INSERT INTO Customers (CustomerName, City, Country) VALUES ('Cardinal', 'Stavanger', 'Norway');
Add the following data to the following fields:
CustomerName,
Address,
City,
PostalCode,
Country
'Hekkan Burger',
'Gateveien 15',
'Sandnes',
'4306',
'Norway';
For the following activities, add the data and give fake data for CustomerName, address, city, postalcode, and country:
Add data of your favorite actor/actress
Add data of your favorite villain
Add your pet's name
Add your favorite cartoon
Add characters from your favorite pixar movie
Add your favorite Harry Potter character