SQL

Due today
Submit a text file (extension .txt).

1- Write a statement that creates a table named Part, with an Id field as an int idendity PK, a SupplierId int field, a Description string field of size 25, a Count int field, a Class string field of size 5, and an inspection small date field. All fields cannot have a value of null, and the SupplierId field should be an FK that references the PK of a Supplier parent table.

2- Write a satement to add a check constraint to the above defined table, which guarantees that values entered in the inspection small date field are not older than today, meaning from now on. According to new requirements from your business analyst, an inspection can only be scheduled in the future.

3- Write a statement to add a check constraint to the above defined table, which guarantees that values entered in the Count field are never less than zero.

4- Write a statement to add a check constraint to the above defined table, which guarantees that values entered in the Class field can only be limited to the following strings: Open, Spec, and Priv.

5- Write a statement to create a view that selects all fields from the above table, except for both Id fields, in addition to the supplier name field of the Supplier table referenced in question 1. Note that the user is only interested in Parts that are not of class Priv. In other words, parts of class Priv should not be returned. Hint: A JOIN must be used to only return common rows.

  1. 👍 0
  2. 👎 0
  3. 👁 66
  1. What kind of HELP do you need? You need to be specific when asking questions here.

    If all you do is post your entire assignment, nothing will happen since no one here will do your work for you. But if you are specific about what you don't understand about the assignment or exactly what help you need, someone might be able to assist you.

    1. 👍 0
    2. 👎 0
  2. 1- Try:
    SELECT Id, SupplierID, Description, Count, Class, inspecton
    INTO Part FROM Supplier;

    You will need to describe the table structure ahead of time.

    For the rest, give it a try and post what you have, and what the problem is, if any.

    1. 👍 0
    2. 👎 0
    posted by MathMate

Respond to this Question

First Name

Your Response

Similar Questions

  1. Unix Shell script

    Shell script Using "if" statement checks for a file called "student.txt" in the current directory. Removes (deletes) the file if it exist. This file will collect last name, first name, and grade for 5 people. Use a while loop to

    asked by Tina on February 26, 2011
  2. Unix Script

    "Using "if" statement checks for a file called "student.txt" in the current directory. Removes (deletes) the file if it exist. This file will collect last name, first name, and grade for 5 people. Use a while loop to get the

    asked by Tina on February 26, 2011
  3. programming

    b. Write a well-commented C++ program that reads data from the input file employee.txt. Each input line consists of last name, first name, base salary, total sales, and number of years of service. Store the output in the file

    asked by karl on June 1, 2013
  4. Statistics

    In a large collection of real SMS text messages from particular cellphone users, 13.40% of messages are identified as spam. Of all spam messages 17.0% contain both the word "free" and the word "text" ("txt") For example,

    asked by E on November 5, 2013
  5. Computer Science

    I need to write a program to solve for the following: Suppose that the file USPRES.txt contains the names fo the frist 43 United States presidents and the file USSENATE.TXT contains the names of all former and present US Senators.

    asked by Wally on March 4, 2011
  6. Technology

    What does a file extension tell you? A. what the file is about******* B. where the file is located C. what type of file it is D. who created the file

    asked by Correct ✅ on January 14, 2019
  7. programming

    You are required to design and write an application that will analyze an input file (InputFile.txt); the file contains a date on each line. Your algorithm should output all the missing dates, excluding Saturdays and Sundays. You

    asked by Anonymous on April 3, 2012
  8. Microsoft word

    To insert text from a separate file into your Word document, A. click Text in the Object group, and then click Text from File. B. click the Object arrow in the Text group, and then click Text from File. C. click TextBox in the

    asked by Daniela on July 17, 2016
  9. C++

    File version maintenance utility   A team of software developers has been asked to develop a file version maintenance utility . The utility should maintain all the  version of a file. When a user modifies a file, the current

    asked by Shodipo john Olawale on May 27, 2011
  10. C code

    //INSTRUCTIONS //Your parser will read from input.txt //input.txt consists of a series inputs that you need to read. //each input is proceeded by a flag. //Each flag will be either I,C, or F. //I means int C means char F means

    asked by Nick on February 13, 2013

More Similar Questions