Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions