psql drop column
ALTER TABLE table_name
DROP COLUMN column_name;
psql drop column
ALTER TABLE table_name
DROP COLUMN column_name;
postgresql delete cascade
CREATE TABLE employee(emp_id SERIAL PRIMARY KEY, name VARCHAR(30),
sector_fk INT NOT NULL);
CREATE TABLE process(emp_id SERIAL PRIMARY KEY, sector VARCHAR(20));
ALTER TABLE employee ADD FOREIGN KEY (sector_fk)
REFERENCES company(emp_id) ON DELETE CASCADE;
-- Deletes cascade employees referencing deleted companies
DELETE FROM company WHERE sector='industry';
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us