Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE aUsers (
- userId INT NOT NULL IDENTITY,
- firstName VARCHAR(100) NOT NULL DEFAULT '',
- lastNAme VARCHAR(100) NOT NULL DEFAULT '',
- PRIMARY KEY (userId)
- );
- CREATE TABLE aAccounts (
- accountId INT NOT NULL IDENTITY,
- accountName VARCHAR(100) NOT NULL DEFAULT '',
- SIZE INT NOT NULL DEFAULT 0,
- PRIMARY KEY (accountId)
- );
- CREATE TABLE aAccess (
- accessLevel INT NOT NULL,
- accessName VARCHAR(100) NOT NULL DEFAULT '',
- PRIMARY KEY (accessLevel)
- );
- CREATE TABLE aUserAccounts (
- accountId INT NOT NULL,
- userId INT NOT NULL,
- accessLevel INT NOT NULL DEFAULT 0
- );
- ALTER TABLE aUserAccounts ADD CONSTRAINT accountIdConstraint FOREIGN KEY (accountId) REFERENCES aAccounts (accountId);
- ALTER TABLE aUserAccounts ADD CONSTRAINT userIdConstraint FOREIGN KEY (userId) REFERENCES aUsers (userId);
- ALTER TABLE aUserAccounts ADD CONSTRAINT accessLevelConstraint FOREIGN KEY (accessLevel) REFERENCES aAccess (accessLevel);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement