Question

Purpose: The purpose of this assignment is to provide an opportunity for you to write SQL...

Purpose: The purpose of this assignment is to provide an opportunity for you to write SQL statements to create tables and insert data into tables.

Skills: Learn and practice the techniques of writing SQL statements using SQL Server Management Studio(SSMS).  

Knowledge: By doing this assignment you will learn to use SSMS and write SQL statements to create new tables and insert data into the tables.

Tasks:

  1. Use the following figure for the tasks below:
  2. [15 points] Write SQL statements to create the tables in the schema Company. Include the primary and foreign key constraints of the schema.
  3. [15 points] Insert the records that are in the database.

Homework Answers

Answer #1

create database client
use client

create schema company


create table company.student(sid int primary key, sname varchar(30), locationName varchar(40) )
create table company.courses(cid int primary key, cname varchar(30), sid int, foreign key(sid)
references company.student(sid) )

insert into company.student values(1001,'basant','US'),(1002,'ritu','INDIA'),(1003,'rani','CANADA')
insert into company.courses values(1,'JAVA',1001),(2,'C++',1002),(3,'DBMS',1003)

select *From company.student
select *from company.courses

DON'T FORGET TO HIT LIKE.

THANKS BY HEART.

COMMENT DOWN IF ANY PROBLEM.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Refer to Critical Thinking Assignment – Option 2 in Module 2. Your tasks begin by generating...
Refer to Critical Thinking Assignment – Option 2 in Module 2. Your tasks begin by generating and executing the SQL statements to create the Sales and Purchased Items tables. Next, you will develop and execute the SQL statements to populate the 2 database tables from the data in their respective tables in the Critical Thinking Assignment. Finally, you will write and execute queries to display all attributes (columns) and tuples (rows) in the 2 database tables. Important reminder, refer to...
Created the database and all the tables in phpMyadmin. In addition, write all the sql statements...
Created the database and all the tables in phpMyadmin. In addition, write all the sql statements used in perforing the tasks in a word document and submit that for grading. Lab 1: CREATE STATEMENT This statement is used to create a database or a table. CREATE DATABASE This statement is used to create a database Syntax: CREATE DATABASE database_name; OR CREATE SCHEMA database_name; Example: CREATE DATABASE Nyumbani; OR CREATE SCHEMA Nyumbani ; CREATE TABLE This SQL statement is used to...
Question 1: Group by and Aggregates: Write SQL statements to answer the following questions using Assignment...
Question 1: Group by and Aggregates: Write SQL statements to answer the following questions using Assignment 4’s schema (Customer-Invoice-Line-Product-Vendor). Make sure that your SQL script runs without any errors. Submit your answers in a .SQL file. 1 (2 Points) - Find the count of distinctvendors thatsupplied products that are priced lowerthan 185? 2 (2 Points) - For each vendor, find their product that has the lowest product quantity. Your output should include vendor code, vendor name, product description and product...
Assignment 2 Instructions You need to access to the database and write SQL queries on the...
Assignment 2 Instructions You need to access to the database and write SQL queries on the following site: https://www.w3schools.com/sql/trysql.asp?filename=trysql_op_in 1. Use INNER JOIN to create a report. In this report, list each customer’s CustomerID, CustomerName, and their each OrderID and each order’s OrderDate, if the customer has ever placed an order. You should use the Customers table and the Orders table in the database to complete this query.   2. Use INNER JOIN to create a report. In this report, list...
PLEASE USE MICROSOFT SQL SERVER MANAGEMENT STUDIO 18 The purpose of this task is to create...
PLEASE USE MICROSOFT SQL SERVER MANAGEMENT STUDIO 18 The purpose of this task is to create a student table such that it has 2 partitions. One that will include all student id's through 500 and a second one that will include all student id's above 500. StudentID                   int           StudentName              varchar(30) *StudentID should be a a primary key. **StudentName should be required. Do you not use the master filegroup. Each partition should be associated with a different physical file. Use any...
Microsoft SQL Server Management Studio 1. Write SQL statements to insert, update, and delete a record...
Microsoft SQL Server Management Studio 1. Write SQL statements to insert, update, and delete a record in each of the Clients, Assist, Task, Outreach, and Specialist tables. Finish by inserting records into the tables (sample data follows). 5 points 2. Write Select statements to organize data from different tables. 4 points each Select all clients who have had an assist; include client name, assist date and type. List all assists including the name of the Specialist. List client names having...
-- Drop the tables if they existDROP TABLE REP CASCADE CONSTRAINTS;DROP TABLE CUSTOMER CASCADE CONSTRAINTS;DROP TABLE...
-- Drop the tables if they existDROP TABLE REP CASCADE CONSTRAINTS;DROP TABLE CUSTOMER CASCADE CONSTRAINTS;DROP TABLE ORDERS CASCADE CONSTRAINTS;DROP TABLE ITEM CASCADE CONSTRAINTS;DROP TABLE ORDER_LINE CASCADE CONSTRAINTS;-- You are to change CUSTOMER to CUSTOMERS for the Colonial database to avoid conflict with the CUSTOMER table in Tal.-- Create the tablesCREATE TABLE REP(REP_NUM CHAR(2) PRIMARY KEY,LAST_NAME CHAR(15),FIRST_NAME CHAR(15),STREET CHAR(15),CITY CHAR(15),STATE CHAR(2),POSTAL_CODE CHAR(5),COMMISSION DECIMAL(7,2),RATE DECIMAL(3,2) );CREATE TABLE CUSTOMER(CUSTOMER_NUM CHAR(3) PRIMARY KEY,CUSTOMER_NAME CHAR(35) NOT NULL,STREET CHAR(20),CITY CHAR(15),STATE CHAR(2),POSTAL_CODE CHAR(5),BALANCE DECIMAL(8,2),CREDIT_LIMIT DECIMAL(8,2),REP_NUM CHAR(2) );CREATE...
SQL DATABASE Task 4 [1.5 marks] Create Index (0.5 marks) Currently, the database only contains a...
SQL DATABASE Task 4 [1.5 marks] Create Index (0.5 marks) Currently, the database only contains a small number of records. However, the data contained within it is expected to grow significantly in the future. Creating indexes on commonly searched columns is a way performance issues can be minimized. Write a command to create an index on student_name column of the student table. Create view – 1 mark Write a command to create a view to list the student ID and...
Write a script to create the following tables with attributes as specified(SQL) Customer table with Customer’s...
Write a script to create the following tables with attributes as specified(SQL) Customer table with Customer’s id, name, address, city as varchar, customer’s date of birth as date type and zip code number where the customers id is the primary key in the table, name and date of birth are mandatory. Id has a 10-character limit, name, address and city have a 50-character limit, zip has a 5-character limit Product Table with Product id, description and finish as varchar, price...
Assignment Instructions (MY WORK IN MYSQLBENCH)- Follow instructions in class to download and build a database...
Assignment Instructions (MY WORK IN MYSQLBENCH)- Follow instructions in class to download and build a database in your DBMS. Write and demonstrate queries (in-class) that do the following: Download the appropriate attached SQL file for your DBMS. Load the file into your database design tool and run it to build the Pine Valley Furniture Company database. This is the database that is used in the textbook examples for both Chapters 5 and 6. Write a query to show the price...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT