id INT NOT NULL AUTO_INCREMENT, location VARCHAR(50) NOT NULL, room INT NOT NULL, propertyType VARCHAR(50) NOT NULL, propertyCondition VARCHAR(50) NOT NULL, price DECIMAL(10, 2) NOT NULL, username1 VARCHAR(50) NOT NULL, profile1 VARCHAR(20) NOT NULL, username2 VARCHAR(50) NOT NULL, profile2 VARCHAR(20) NOT NULL, status VARCHAR(50) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (username1) REFERENCES Accounts(username), FOREIGN KEY (profile1) REFERENCES Accounts(profile), FOREIGN KEY (username2) REFERENCES Accounts(username), FOREIGN KEY (profile2) REFERENCES Accounts(profile) );
INSERT INTO propertyListings (location, room, propertyType, propertyCondition,
username VARCHAR(50) NOT NULL, profile VARCHAR(20) NOT NULL, id INT NOT NULL, PRIMARY KEY (username, profile, id), FOREIGN KEY (username) REFERENCES Accounts(username), FOREIGN KEY (profile) REFERENCES Accounts(profile), FOREIGN KEY (id) REFERENCES propertyListings(id) );
insert into buyList(username,profile,id)
values ('buyer','Buyer','1');
insert into buyList(username,profile,id)
values ('buyer','Buyer','2');
CREATE TABLE review (
id INT AUTO_INCREMENT PRIMARY KEY, star INT NOT NULL, review TEXT NOT NULL, username1 VARCHAR(50) NOT NULL, profile1 VARCHAR(20) NOT NULL, username2 VARCHAR(50) NOT NULL, profile2 VARCHAR(20) NOT NULL, FOREIGN KEY (username1) REFERENCES Accounts(username), FOREIGN KEY (profile1) REFERENCES Accounts(profile), FOREIGN KEY (username2) REFERENCES Accounts(username), FOREIGN KEY (profile2) REFERENCES Accounts(profile) );