Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help with basic SQL using Oracle DB. I am new to Oracle DB. I have NO IDE

ID: 3662843 • Letter: P

Question

Please help with basic SQL using Oracle DB. I am new to Oracle DB. I have NO IDEA what I am supposed to do, never used CREATE TABLE or anything Oracle in my life, I am only familiar with pre-made tables using Microsoft SQL. Please help me. I think this is a very basic/easy assignment because it's our first one using Oracle Database.

I think the first thing Im supposed to do is use the DESCRIBE command.

He writes "The data for your SalesDB tables is available in reference tables in the C##SALESDB database. You should begin with a DESCRIBE on the C##SALESDB tables (i.e. in an SQL Developer worksheet describe C##SALESDB.customers)."

My database information is below (image) and the instructions for this assignment is below. Please make sure it's correct and to use proper formatting, syntax, etc and capitalization... I will comment if it's not correct. Thanks so much!

Assignment Instructions: Create a .sql file that contains the CREATE TABLE statements to build the SalesDB tables. Include the primary keys, foreign keys, and domain constraints shown in the Database Design section (above) in your CREATE TABLE statements. The order of statements is important.

Explanation / Answer

CREATE TABLE customers

( custid number(4) NOT NULL,

cname varchar2(25) NOT NULL,

credit varchar2(1),

CONSTRAINT customers_pk PRIMARY KEY (custid)

);

CREATE TABLE salespersons

( empid number(4) NOT NULL,

ename varchar2(25) NOT NULL,

rank number(2),

salary decimal(8,2) default 1000.00

CONSTRAINT salesperson_pk PRIMARY KEY (empid)

);

CREATE TABLE inventory

( partid number(4) NOT NULL,

Description varchar2(25) NOT NULL,

stockqty varchar2(12),

reorderpnt number(4),

price decimal(8,2),

CONSTRAINT inventory_pk PRIMARY KEY (partid)

);

CREATE TABLE orders

( orderid number(4)NOT NULL,

empid number(4) NOT NULL,

custid number(10),

sales date date,

CONSTRAINT orders_pk PRIMARY KEY (order id),

CONSTRAINT fk_salesperson,customers

    FOREIGN KEY (empid,custid)

    REFERENCES (salesperson.empid,customers.custid)

);

CREATE TABLE orderitems

( orderid number(4)NOT NULL,

detail number(2) NOT NULL,

partid number(4) NOT NULL

qty number(6) NOT NULL ,

CONSTRAINT orderitems_pk PRIMARY KEY (order id,detail),

CONSTRAINT fk_orders,inventory

    FOREIGN KEY (orderid,partid)

    REFERENCES (orders.orderid,inventory.partid)

);

Syntax for describe command: desc <table-name>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote