Suppose you have two tables: Table Product:
|
PROD_ID |
PROD_NAME |
PROD_PRICE |
PROD_PROD_DATE |
PROD_VENDOR |
|
1101 |
Table |
100 |
1-Jan-18 |
2 |
|
1102 |
Chair |
80 |
3-Mar-18 |
3 |
|
1103 |
Armchair |
90 |
6-May-18 |
2 |
|
1104 |
Nightstand |
110 |
4-Apr-18 |
1 |
|
1105 |
Bed |
200 |
3-Mar-18 |
3 |
|
1106 |
Dresser |
150 |
5-May-18 |
3 |
|
1107 |
Daybed |
190 |
10-Feb-18 |
2 |
Table Vendor:
|
VEND_ID |
VEND_NAME |
VEND_ST |
|
1 |
Green Way Inc |
GA |
|
2 |
Forrest LLC |
NC |
|
3 |
AmeriMart |
NC |
For Product Table
primary key:PROD-ID
foreign key:
For Vendor Table
primary key:VEND_ID
to create vendor table:
CREATE TABLE Vendor(VEND_ID number(3) primary key,VEND_NAME varchar(20),VEND_ST varchar(10));
desc Vendor;

CREATE TABLE Product(PROD_ID number(4) primary key,PROD_NAME varchar(20),PROD_PRICE number(4),PROD_PROD_DATE date,PROD_VENDOR references Vendor(VEND_ID));
desc Product;

insert into Vendor values(1,'Green Way Inc','GA');
insert into Vendor values(2,'Forrest LLC','NC');
insert into Vendor values(3,'AmeriMart','NC');
select * from Vendor;

insert into Product values(1101,'Table',100,'1-Jan-18',2);
insert into Product values(1102,'Chair',80,'3-Mar-18',3);
insert into Product values(1103,'armchair',90,'6-May-18',2);
insert into Product
values(1104,'Nightstand',110,'4-Apr-18',1);
insert into Product values(1105,'Bed',200,'3-Mar-18',3);
insert into Product values(1106,'Dresser',150,'5-May-18',3);
insert into Product values(1107,'Daybed',190,'10-Feb-18',2);
select * from Product;

FOR Quicklook up question
ill use product table
TO CHECK THE PRODUCTS SUPPLYED BY VENDOR 2
WE WRITE
select PROD_VENDOR,PROD_ID,PROD_NAME from Product where PROD_VENDOR=2;

RELATIONAL SCHEMA

Suppose you have two tables: Table Product: PROD_ID PROD_NAME PROD_PRICE PROD_PROD_DATE PROD_VENDOR 1101 Table 100 1-Jan-18...
If two tables have a many-to-many relationship, you need to define a/an _____________ table that relates their records. 10 points Question 2 The most common type of relationship between two tables is called a/an _______________ relationship. 10 points Question 3 The rows in a table are kept in the sequence that’s based on its __________________________ index. 10 points Question 4 To maintain _________________________________, if you delete a row in a primary key table, you must also delete any related rows...
Really need help on this, apperciate all answers and feedback =D. You are the Senior Consultant at Abacus Consulting, tasked with the database project for Amadeus Real Estate client. The company employs real estate agents who work with customers to buy and sell properties (both residential and commercial). As part of your lead role, you are initially responsible for meeting with the client team and gathering requirements. You are then scheduled to design the data model and implement a working...
PROBLEM STATEMENT: Suppose you have a client that has given you
the following business rules to form the basis for a database
design. The database must enable the manager of a company dinner
club to mail invitations to the club’s members, to plan the meals,
to keep track of who attends the dinners, and so on. Each dinner
serves many members, and each member may attend many dinners. A
member receives many invitations, and each invitation is mailed to
many...
I am using Oracle SQL and am new to it. I have seven tables, one
of them is a subtable of two of the others. I need to do the
following queries:
1. List all Patients
and what Bed they are assigned to
2. List all patients
who had Treatments and what Treatment they received
3. List all patients
who had tests and what Test they had
4. List the employees
(doctors, nurses, etc.) who assisted each patient.
5. List...
ChangeRequest(CRID, CRType, CRTitle, CROriginDate, CRPriority, CRNeedEvent, CRStatus) NeedByEvent(Event) CRPrevState(CRID, CRState, StartDate, EndDate) CRAssigned(CRID, EmpID, StartDate, EndDate) Employees(EmpID, FirstName, LastName, JobTitle) ChangeRequest(CRID, CRType, CRTitle, CROriginDate, CRPriority, CRNeedEvent, CRStatus) The CRID is the primary key, it is unique, and it is an positive integer The CRType may be one of two values: "Deficiency" or "Enhancement" CRTitle is a variable length string that may be up to 2048 characters CROriginDate is a date CRPriority is an integer that may assume a value of...
Please do not delete the questions. 1. What is the purpose of a database? 2. What is the reason to use a database over a spreadsheet? 3. Based on the previous answers (#1 & #2), there is a simple rule of thumb. A spread sheet is used when there is _________________________. A database is used when there are _________________________. 4. Please answer followings. a) A group of 8 bits is called a ____________ (from Chapter 4). b) The answers of...