Question
in postgresSQL im trying to create a foreign key that links the first_name to the balance in the bank table DROP TABLE IF EXISTS accounts;
in postgresSQL im trying to create a foreign key that links the first_name to the balance in the bank table
DROP TABLE IF EXISTS accounts; DROP TABLE IF EXISTS bank;
CREATE TABLE accounts ( id SERIAL, first_name VARCHAR(50) PRIMARY KEY, last_name VARCHAR (50), email VARCHAR (50), password VARCHAR (50), account_Type VARCHAR (10), bday VARCHAR (50) );
INSERT INTO accounts ( first_name, last_name, email, password, account_Type, bday) VALUES ('bob', 'john', 'bob@gmal.com', 'bob1','Manager', '01/01/1985'), ('Tom', 'lin', 'tom@gmal.com', 'tom1', 'Manager', '5/23/1990');
CREATE TABLE bank( balance VARCHAR(20) REFERENCES accounts(first_name) );
INSERT INTO bank( balance) VALUES ('50000'),('100000');
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started