Solution:
Customer table:
1.Creating a customer table:
- To create a table, the following syntax is followed.
- Mandatory fields can be specified using NOT NULL.
create table customer(
customer_id varchar(10) primary key,
name varchar(50) NOT NULL,
address varchar(50),
city varchar(50),
date_of_birth date NOT NULL,
zip_code number(5)
);
2. Inserting values in the table:
insert into customer values("Customer ID : 101","Name : John","Address : 123 Main St","City : NewYork","DOB : 10/08/1997","ZipCode : 50006");
3. Displaying the inserted values of customer table:
- To display all the inserted values of the table, we can use * operator.
select * from customer;
Product Table:
1.Creating a product table:
create table product(
product_id varchar(15) NOT NULL primary key,
customer_id varchar(10),
description varchar(125) NOT NULL,
finish varchar(10),
price float(5) NOT NULL,
foreign key(customer_id)
references customer(customer_id)
);
2. Inserting values in the table:
insert into product values("Product ID : 500","Customer ID : 101","Description : coffee","Finish : no","Price : 635.5");
3. Displaying the inserted values of Product table:
select * from product;
Output:
Customer ID : 101|Name : John|Address : 123 Main St|City : NewYork|DOB : 10/08/1997|ZipCode : 50006 Product ID : 500|Customer ID : 101|Description : coffee|Finish : no|Price : 635.5
Get Answers For Free
Most questions answered within 1 hours.