Question: First create a practice database, then add 2 new tables, customers and orders, each table should have primary keys auto - increments defined. Then, answer
First create a practice database, then add new tables, customers and orders, each table should have primary keys autoincrements defined.
Then, answer each question below by providing a screenshot of the query and the output results.
Create a table customers with the following fields id firstname, lastname, email. Make sure the id is set as a primary key. Provide a query.
Create a SQL query to create a new table called "orders" with the following columns:
orderid integer primary key
customerid integer foreign key referencing id in the customers table
orderdate date
ordertotal decimal
Write a query to insert a new record into a MySQL database using the INSERT statement. Provide a query.
Write a query for selecting all columns from a table named "customers" in a MySQL database using the SELECT statement. Provide a query.
Write a query for selecting only the "firstname", "lastname", and "email" columns from the "customers" table. Provide a query.
Write a query for updating an existing record in a MySQL database using the UPDATE statement? Provide a query.
Insert a few test records into table orders with various ordertotals and Note: the customerid should match the id defined in the customers table. Provide a query.
Write a MySQL query that selects all rows from two tables "customers" and "orders" where the user's ID matches the order's user ID Return the user's first name, last name, and the order's total price. Provide a query.
Write a MySQL query that selects all rows from two tables "customers" and "orders" where the user's ID matches the order's user ID and total price is more than Return the user's first name, last name, and the order's total price. Provide a query.
Write a query for removing a singe record or multiple records from a MySQL database using the DELETE statement? Provide a query.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
