DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2013

    Incredibly Basic Help


    First let me apologize for posting - everyone is wary of new posters and trolls.

    I'm taking a class on SQL databases, and I'm struggling cause it's online so examples are lacking, and the ability to ask questions are limited.

    I have this assignment:

    The Oracle Server may be used to test and compile the SQL Queries developed for this assignment. Your instructor will provide you with login credentials to a University maintained Oracle server.

    Imagine that you have been hired as a consultant to assist in streamlining the data processing of an international based organization that sells high-end electronics. The organization has various departments such as payroll, human resources, finance, marketing, sales, and operations. The sales department is the only department where employees are paid a commission in addition to their yearly salary and benefits. All other departments compensate their employees with a yearly salary and benefits only. Commission is paid by multiplying the employee’s commission rate by the total amount of product units sold. You have access to the following data sets:
    Employee (EmpNumber, EmpFirstName, EmpLastName, CommissionRate, YrlySalary, DepartmentID, JobID)

    Invoice (InvNumber, InvDate, EmpNumber, InvAmount)

    InvoiceLine (InvLineNumber, InvNumber, ProductNumber, Quantity)

    Product (ProductNumber, ProductDescription, ProductCost)

    Department (DepartmentID, DepartmentDescription)

    Job (JobID, JobDescription)

    Design a query that will allow the finance department to determine the commissions paid to specific employees of the sales department for the month of December. Note: You will need to generate the tables described above (Employee, Invoice, InvoiceLine, Product, Department, and Job) in order to compare and validate your code. Validated query code must be part of your paper.
    I know this is incredibly basic, but how do I generate the query code?

    As an example, I've tried:

    create table employee (
    column 1 empnumber
    column 2 emplastname
    column 3 empfirstname );

    just to try to generate a table so I know I have the syntax right.

    But despite my variations, I keep getting errors thrown at me. I know this is pretty basic, but can anyone give me an example of a working query?

    This is obviously homework help - I'm not looking for someone to do the assignment for me, I'm simply confused on the nature of how I should structure the query in the first place.

    I found this link: http://docs.oracle.com/cd/B28359_01/...03.htm#autoId0 which is incredibly informative, but I really just need a working example and can expand from there...

    This should be simple, I know I'm missing something.

    For instance, if I try to generate the Job table listed in the assignment using this:

    create table Job (
    column1 jobid
    column2 jobdescription

    It returns this:
    column2 jobdescription
    ERROR at line 3:
    ORA-00907: missing right parenthesis

    Which makes even less sense to me...why didn't column1 show up, but line 3, which has the error, does?

    Please help.

    P.S. Sorry if wrong sub-forum.

  2. #2
    Join Date
    Nov 2000
    Pittsburgh, PA
    Hi SQL Confused,

    Here is some of the SQL that you need. I'm not sure where you got the SQL, but the columns in the create table are a comma delimited list, that should also include constraints such as primary key and foreign keys. The query you want involves an aggregate query of the invoice table joined to the employee table, using the SUM() function, joining on the EmpNumber column.

    Good luck with your homework!

    create table Job (
       jobid               NUMBER NOT NULL,
       jobdescription      VARCHAR2(128),
       CONSTRAINT job_pkey PRIMARY KEY ( jobid ) );
    create table employee (
       empnumber           NUMBER NOT NULL,
       Title               VARCHAR2(32),
       emplastname         VARCHAR2(32),
       empfirstname        VARCHAR2(32),
       job_title           VARCHAR2(32),
       CommissionRate      NUMBER,
       YrlySalary          NUMBER,
       DepartmentID        NUMBER,
       JobID               NUMBER,
       CONSTRAINT employee_pkey     PRIMARY KEY (empnumber),
       CONSTRAINT employee_job_fkey FOREIGN KEY (JobID) REFERENCES Job(Jobid)
    this space intentionally left blank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.