SQL for business help

posted by .

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 value of the Part table. You should enter sample test records in the Part table if you are running/testing this function in SQL Server.

  • SQL for business help -

    Try the max() and min() functions.

    Depending on the flavour of the SQL you're using, you could do something like:

    SELECT MAX(PartCount)-MIN(PartCount) AS CountRange FROM PartsTable;

    If you need a "function" and not a select statement, it depends on the SQL you're using (e.g. PL/SQL for Oracle)

    Need more help on syntax and examples? Try the W3Schools tutorials.

    http://www.w3schools.com/Sql/sql_func_max.asp

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

    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 …
  4. C++

    Write a statement that passes the value 4 to the function below and assign it's return value to the variable result. Thank You. int cube(int num) { return num*num*num; }
  5. 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 …
  6. computer

    construct function prototypes for descriptions given below: 1) Rarb() takes no arguments and has no return value. 2) Mains() takes a float argument and returns an int. 3) San() takes two double arguments and returns a double. 4) Sum() …
  7. 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 …
  8. computer science

    int *reverse(const int *, int); int *temp; temp = reverse(arr1,N); int *reverse(const int *arr1, int N) { int *arr2; arr2 = new int[N]; for(int count = 0; count < N; count++) { for(int index = (N-1); index <= 0; index--) arr2[count] …
  9. computer science

    Im trying to create an arraylist that's sorted but I have no idea how to sort the numbers. I cant use the array.sort method here is my code: public class Testing { private int [] data; private int count; private static int defCapacity …
  10. programming

    m trying to create an arraylist that's sorted but I have no idea how to sort the numbers. I cant use the array.sort method here is my code: public class Testing { private int [] data; private int count; private static int defCapacity …

More Similar Questions