Popular
- Get link
- X
- Other Apps
SQL Script
DROP DATABASE IF EXISTS FullStackDev;
CREATE DATABASE IF NOT EXISTS FullStackDev;
USE FullStackDev;
-- Create table Employee --
CREATE TABLE `Employee` (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(50) NOT NULL
);
-- Create table RegularEmployee --
CREATE TABLE `RegularEmployee` (
id INT UNSIGNED PRIMARY KEY,
salary INT NOT NULL,
bonus INT NOT NULL,
FOREIGN KEY (id) REFERENCES `Employee`(id)
);
-- Create table ContractEmployee --
CREATE TABLE `ContractEmployee` (
id INT UNSIGNED PRIMARY KEY,
pay_per_hour INT NOT NULL,
contract_duration VARCHAR(50) NOT NULL,
FOREIGN KEY (id) REFERENCES `Employee`(id)
);
INSERT INTO `Employee` (`name`)
VALUE ('name1'),
('name2'),
('name3');
INSERT INTO `RegularEmployee` (id, salary, bonus)
VALUE (1, 2000, 100),
(2, 2000, 200);
INSERT INTO `ContractEmployee` (id, pay_per_hour, contract_duration)
VALUE (3, 10, '3 years');
select * from employee
- Get link
- X
- Other Apps
Comments
Post a Comment