can anyone tell if it is the right way to connect these tables?

What is the query display customerid, b_customer_id, and h_customer_id... thxxx

--customers

drop table Customers cascade constraint;
create table Customers(
Customer_id Number(5) primary key not null,
Credit varchar2(20),
Street varchar2(20),
City varchar2(12),
State varchar2(2),
Zip varchar2(5),
Telephone varchar2(14));

--business_customer

drop table business_customers cascade constraint;
create table business_customers(
b_customer_id number(5) primary key not null,
b_customer_name varchar2(20), 
FOREIGN KEY (b_customer_id) references Customers);

--home_customers

drop table home_customers cascade constraint;
create table home_customers(
h_customer_id number(5) not null,
h_customer_lastname varchar(10),
h_customer_firstname varchar(10),
PRIMARY KEY (h_customer_id),
FOREIGN KEY (h_customer_id) references Customers);

Recommended Answers

All 2 Replies

try this. same on the third

--customers

DROP TABLE CUSTOMERS cascade constraint;

CREATE TABLE CUSTOMERS(
Customer_id Number(5) CONSTRAINT customer_customer_id_pk PRIMARY KEY,
Credit varchar2(20),
Street varchar2(20),
City varchar2(12),
State varchar2(2),
Zip varchar2(5),
Telephone varchar2(14));

--business_customer

DROP TABLE business_customers cascade constraint;

CREATE TABLE business_customers(
b_customer_id number(5) CONSTRAINT business_customers_b_customer_id_pk PRIMARY KEY,
b_customer_name varchar2(20), CONSTRAINT business_customers_b_customer_id_fk FOREIGN KEY (b_customer_id) REFERENCES CUSTOMERS(customer_id));

Kindly post the query that you are working on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.