Question

In: Computer Science

Using your downloaded DBMS (MS SQL Server or MySQL), write SQL queries that inserts at least...

Using your downloaded DBMS (MS SQL Server or MySQL), write SQL queries that inserts at least three rows in each table.

    1. For the On-Demand Streaming System,
      1. First, insert information for multiple users, at least three video items and insert the three different types of subscriptions (Basic, Advanced, Unlimited) into the database.
      2. Then insert at least three user subscriptions.
  1. Execute the queries and make sure they run correctly

Solutions

Expert Solution

We will use the sales.promotions table created in the previous tutorial for the demonstration.

If you have not yet created the sales.promotions table, you can use the following CREATE TABLE statement:

 

CREATE TABLE sales.promotions ( promotion_id INT PRIMARY KEY IDENTITY (1, 1), promotion_name VARCHAR (255) NOT NULL, discount NUMERIC (3, 2) DEFAULT 0, start_date DATE NOT NULL, expired_date DATE NOT NULL );

1) Inserting multiple rows example

The following statement inserts multiple rows to the sales.promotions table:

 

INSERT INTO sales.promotions ( promotion_name, discount, start_date, expired_date ) VALUES ( '2019 Summer Promotion', 0.15, '20190601', '20190901' ), ( '2019 Fall Promotion', 0.20, '20191001', '20191101' ), ( '2019 Winter Promotion', 0.25, '20191201', '20200101' );

SQL server issued the following message indicating that three rows have been inserted successfully.

 

(3 rows affected)

Let’s verify the insert by executing the following query:

 

SELECT * FROM sales.promotions;


Related Solutions

Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based...
Using your downloaded DBMS (MS SQL Server), create a new database. Create the database tables based on your entities defining The attributes within each table The primary and foreign keys within each table *****Show your database tables, tables attributes, primary and foreign keys***** Do not forget to check the lesson slides and videos that show you how to convert an ER/EER into a database schema, and how to create a database and tables using MS SQL Server.
Write the following SQL queries and show the corresponding output of the DBMS: 1) Write an...
Write the following SQL queries and show the corresponding output of the DBMS: 1) Write an SQL statement to display all the information of all Nobel Laureate winners. 2) Write an SQL statement to display the string "Hello, World!". 3) Write an SQL query to display the result of the following expression: 2 * 14 +76. 4) Write an SQL statement to display the winner and category of all Laureate winners. 5) Write an SQL query to find the winner(s)...
What are the keywords available in MS Access to use in SQL queries to enforce these...
What are the keywords available in MS Access to use in SQL queries to enforce these data integrity constraints? Discuss these with proper SQL queries.
Write the SQL queries that accomplish the following tasks using the AP Database 9. Write a...
Write the SQL queries that accomplish the following tasks using the AP Database 9. Write a select statement to show the invoicelineitemdescriptions that have the total invoicelineitemamount >1000 and the number of accountno is >2. 10. Write a select statement that returns the vendorid, paymentsum of each vendor, and the number of invoices of each vendor, where paymentsum is the sum of the paymentotal column. Return only the top ten vendors who have been paid the most and the number...
6-Microsoft SQL Server is a​ ________ for large mainframes and midrange computers. A.SimpleDB B.MongoDB C.relational DBMS...
6-Microsoft SQL Server is a​ ________ for large mainframes and midrange computers. A.SimpleDB B.MongoDB C.relational DBMS D.NoSQL E.distributed database 16-SQL stands for​ ________. A.Structured Query Language B.Streamlined Question Language C.Structured Question Language D.Special Question Language E.Structured Questioning Language 18-Which of the following is a distributed database technology that enables firms and organizations to create and verify transactions on a​ peer-to-peer network nearly instantaneously without a central​ authority? A.MySQL B.DB2 C.NoSQL D.Blockchain E.Cloud Spinner 19-What makes a Blockchain system possible and...
Design and implement a relational database application of your choice using MS Workbench on MySQL a)...
Design and implement a relational database application of your choice using MS Workbench on MySQL a) Declare two relations (tables) using the SQL DDL. To each relation name, add the last 4 digits of your Student-ID. Each relation (table) should have at least 4 attributes. Insert data to both relations (tables); (15%) b) Based on your expected use of the database, choose some of the attributes of each relation as your primary keys (indexes). To each Primary Key name, add...
a) What are the most important differences between MS Access and as Server database like SQL...
a) What are the most important differences between MS Access and as Server database like SQL Server? b) Does Access have any advantages over SQL Server? c) Describe one or more scenarios where you would recommend upgrading an existing MS Access application to SQL Server. Not the use of SQL Server Express edition.
Basic SQL Use the following schema to answer the queries below using SQL DEVICE [dno, dtype,...
Basic SQL Use the following schema to answer the queries below using SQL DEVICE [dno, dtype, price] PROVIDER [pno, pname, web] SERVICE [dno, pno, servicedate] SERVICE.dno references DEVICE.dno SERVICE.pno references PROVIDER.pno bold is underline. a) Find the dno for the most expensive device b) Find all providers that have the work fast in the name c) Find the number of different device types (dtype) d) Give all details of devices with price more than $400
Does the data contain errors? If so, write queries in SQL to find these errors and...
Does the data contain errors? If so, write queries in SQL to find these errors and propose a way to address the issues Theres a change of weight error (end weight-start weight) calculated wrong and a logical error
Write SQL queries below for each of the following: List the names and cities of all...
Write SQL queries below for each of the following: List the names and cities of all customers List the different states the vendors come from (unique values only, no duplicates) Find the number of customers in California List product names and category descriptions for all products supplied by vendor Proformance List names of all employees who have sold to customer Rachel Patterson
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT