Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, please consider the attached Bookstore database schema and complete the following / let me know what queries to use on MS SQL Server: 1

Hello, please consider the attached Bookstore database schema and complete the following/let me know what queries to use on MS SQL Server:
1.Create the database and its tables. Use the Field Names as given. Decide on the appropriate Data Types.
2.Use the INSERT queries below to add rows to the associated tables:
EMPLOYEE TABLE:
INSERT INTO EMPLOYEE
VALUES (1,'John', 'Doe', 1),
(2,'Jane', 'Smith', 2),
(3,'Bob', 'Johnson', 1);
DEPARTMENT TABLE:
INSERT INTO DEPARTMENT
VALUES (1,'Sales'),
(2,'Marketing');
SALESORDER TABLE:
INSERT INTO SALESORDER
VALUES (101,1,'2024-04-01',1000.00),
(102,2,'2024-04-05',1500.50),
(103,3,'2024-04-10',2000.75);
3.After inserting the rows to the tables, create the appropriate SQL queries to achieve the following tasks.
3.1.Retrieve all employees whose first name starts with 'J'.
3.2.Retrieve all orders placed between April 1st,2024 and April 10th,2024.
3.3.Retrieve all departments with DepartmentID1 and 2.
3.4.Retrieve all employees who have been assigned to a department.
3.5.Retrieve distinct combinations of EmployeeID, FirstName, and LastName from the EMPLOYEE table.
3.6.Retrieve EmployeeID, FirstName, LastName, and DepartmentName of all employees along with their corresponding departments.
3.7.Retrieve EmployeeID, FirstName, LastName, and OrderDate of all employees and their orders. Include all employees even if they haven't placed any orders. Hint LEFT JOIN.
3.8.Retrieve EmployeeID, FirstName, LastName, and OrderDate of all employees and their orders. Include all employees even if they haven't placed any orders. Hint OUTER JOIN.
3.9.Retrieve all orders placed on or after April 1st,2024.
3.10.Add a new column 'Email' to the EMPLOYEE table. The column must have a length of 100
3.11.Retrieve EmployeeID, FirstName, and LastName of employees who belong to the 'Sales' department.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How to reverse a Armstrong number by using double linked list ?

Answered: 1 week ago