SQL

posted by .

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.

  • SQL -

    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.

  • SQL -

    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.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. sql

    By using this table below I need to Write a SQL statement that creates a stored procedure with one int input parameter. The stored procedure selects the supplierId field and the total of all Count field values for each group of supplierId's …
  2. SQL for Business

    By using this table: CREATE TABLE Part ( Partid int IDENTITY PRIMARY KEY, Supplierid int NOT NULL REFERENCES Part (PartID), Description VARCHAR (25) NOT NULL, Count int NOT NULL, Class VARCHAR (5) NOT NULL, Inspection smalldatetime …
  3. SQL

    1- A SQL statement is needed to create a stored procedure that has one input parameter of data type int. The stored proc selects the supplierId field and the total, or sum, of all Count field values for each group of supplierId fields …
  4. SQL server help!

    A SQL statement is needed to create a stored procedure, which adds a new record to the Part table of week 3. The stored proc returns an out parameter that contains the value of the PartID PK of the record just added. Input parameters …
  5. SQL for business help

    I have no idea where to begin with this. A SQL statement that creates a user defined function that returns an int value is needed. This int return value is obtained by deducting the lowest Count field value from the highest Count field …
  6. computer science

    9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should …
  7. 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 float. …
  8. physics

    identify tie force fields from the following : density field, temperatuse field, gravitational field, magnetic field, electrostatic field, electric field
  9. calculus

    use symmetry to evaluate the double integral (1+x^2siny+y^2sinx)dA, R=[-pi,pi]x[-pi,pi]. let g(x) and h(y) be two functions: int(c to d)int(a to b)(g(x,y)+h(x,y))dxdy=int(c to d)int(a to b)g(x,y)dxdy+int(c to d)int(a to b)h(x,y)dxdy
  10. Java programming

    Okay so I am rewrite the program and it's still not coming right can anyone help me see what's going wrong here please I have to turn this in by tmw so here the program The following program is supposed to read two numbers from a file …

More Similar Questions