Question

In: Computer Science

You should try this code in Microsoft SQL Server to get the practice of using the...

You should try this code in Microsoft SQL Server to get the practice of using the command line and getting syntax errors. You can submit to me your sql files or just copy and paste of your code in a word document. I may try to run it, so make sure it is error free. Or you can show screen shots of code running.

  1. Write SQL CREATE Table statement to create the following table with  Owner ID  as a surrogate key.  Owner ID is a surrogate key (starts at 1 and increments by 1)

hint: IDENTITY (1, 1) is syntax for surrogate key.

PET_OWNER (OwnerID, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail)

You can try inserting some data into your tables too!

  1. Write SQL CREATE Table statement to create the following table with  Pet ID as a surrogate key.  Pet ID is a surrogate key (starts at 1 and increments by 1)

hint: IDENTITY (1, 1) syntax for surrrogate key..

PET (PetID, PetName, PetType, PetBreed, PetDOB, OwnerID)

You don’t need to create referential integrity constraint on OwnerID in PET table.

  1. Now create the referential integrity constraint on OwnerID in PET. You can use ALTER TABLE command.

Solutions

Expert Solution

Question1:
Write SQL CREATE Table statement to create the following table with Owner ID as a surrogate key.

Table:

PET_OWNER (OwnerID, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail)

Crate statement:


CREATE TABLE PET_OWNER(
OwnerID INT IDENTITY(1,1),
OwnerLastName varchar(255),
OwnerFirstName varchar(255),
OwnerPhone varchar(25),
OwnerEmail varchar(255)
);

Question-2:

Write SQL CREATE Table statement to create the following table with Pet ID as a surrogate key. Pet ID is a surrogate key (starts at 1 and increments by 1)

Table:

PET (PetID, PetName, PetType, PetBreed, PetDOB, OwnerID)

Note: You don’t need to create referential integrity constraint on OwnerID in PET table.

Crate statement:

CREATE TABLE PET(
PetID INT IDENTITY(1,1),
PetName varchar(255),
PetType varchar(255),
PetBreed varchar(25),
PetDOB DATE
);


3)
Now create the referential integrity constraint on OwnerID in PET. You can use ALTER TABLE command.

ALTER TABLE PET ADD FOREIGN KEY(OwnerID) REFRENCES OWNER(OwnerID);


Related Solutions

You should try this code in Microsoft SQL Server to get the practice of using the...
You should try this code in Microsoft SQL Server to get the practice of using the command line and getting syntax errors. You can submit to me your sql files or just copy and paste of your code in a word document. I may try to run it, so make sure it is error free. Or you can show screen shots of code running. Write SQL CREATE Table statement to create the following table with  Owner ID  as a surrogate key.  Owner ID...
Which of the following is a database client software? Microsoft SQL Server 2017 Developer Microsoft SQL...
Which of the following is a database client software? Microsoft SQL Server 2017 Developer Microsoft SQL Server Management Studio Microsoft SQL Server Configuration Manager SQL Server Analysis Service Compared to Data Warehousing approach, the following are disadvantages of query-driven data integration approach, EXCEPT: __________. competition with local processing at source delay in query processing waste of storage space inefficient and potentially expensive for frequent queries What does OLAP stand for? Olympic Linear Algebra Problem On-Line Amazon Platform On-Line Analytical Processing...
Research Microsoft SQL Server and in your own words, describe your understanding of this and its...
Research Microsoft SQL Server and in your own words, describe your understanding of this and its role in Microsoft's model for web programming. Be sure to list your sources by providing links and/or printed book/article names. As one open option available to us is Microsoft SQL Server Express, for your response discuss too which is better for development. SQL Server Express or a full SQL Server environment?
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...
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. For the On-Demand Streaming System, 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. Then insert at least three user subscriptions. Execute the queries and make sure they run correctly
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft...
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft Access, Oracle, or MySQL) as indicated by your professor. After creating the database – populate it with some data (could be made up). SQL syntax and the DB application will be discussed and taught in class. This is the final deliverable of the group project. Assignment is due by the due date as indicated by your professor. *Make sure to submit the completed database...
I am working on an assignment using SQL Server Management and I need to print an...
I am working on an assignment using SQL Server Management and I need to print an ERD to a single page as a PDF file. I am not sure how to do this especially because the diagram is rather large... I am using SQL Server Management Studio I have created an Entity relationship diagram for AdventureWorks that includes all product tables. There are many tables.How do I print it to a single page?
should the federal reserve try to get the inflation rate to zero?
should the federal reserve try to get the inflation rate to zero?
(Try to work this question WITHOUT using Excel, get answer by using the formula and show...
(Try to work this question WITHOUT using Excel, get answer by using the formula and show the calculations in detail) Question (Retirement planning) You have just graduated Hofstra University at age 22. You hard work has paid off as you already have a job as an investment banker at Goldman Sachs waiting for you. You plan to work continuously until age 65 and retire exactly on that day. You expect to live until exactly 90 and enjoy your golden years...
In the Topic Materials, you learned about exporting SQL Server Data to Excel. Explain the two...
In the Topic Materials, you learned about exporting SQL Server Data to Excel. Explain the two options for exporting data using the SQL Server Import and Export Wizard, and provide examples of when each option should be selected.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT