Answered step by step
Verified Expert Solution
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 followinglet me know what queries to use on MS SQL Server:
Create the database and its tables. Use the Field Names as given. Decide on the appropriate Data Types.
Use the INSERT queries below to add rows to the associated tables:
EMPLOYEE TABLE:
INSERT INTO EMPLOYEE
VALUES 'John', 'Doe',
'Jane', 'Smith',
'Bob', 'Johnson', ;
DEPARTMENT TABLE:
INSERT INTO DEPARTMENT
VALUES Sales
'Marketing';
SALESORDER TABLE:
INSERT INTO SALESORDER
VALUES
;
After inserting the rows to the tables, create the appropriate SQL queries to achieve the following tasks.
Retrieve all employees whose first name starts with J
Retrieve all orders placed between April st and April th
Retrieve all departments with DepartmentID and
Retrieve all employees who have been assigned to a department.
Retrieve distinct combinations of EmployeeID, FirstName, and LastName from the EMPLOYEE table.
Retrieve EmployeeID, FirstName, LastName, and DepartmentName of all employees along with their corresponding departments.
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.
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.
Retrieve all orders placed on or after April st
Add a new column 'Email' to the EMPLOYEE table. The column must have a length of
Retrieve EmployeeID, FirstName, and LastName of employees who belong to the 'Sales' department.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started