Skip to content
Snippets Groups Projects
ScheduleApp.sql 1.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • create database ScheduleApp;
    use ScheduleApp;
    create table Employees(
    	employee_ID INT NOT NULL auto_increment,
    	first_name varchar(25),
        last_name varchar(25),
        primary key (employee_ID)
        );
        
    create table Shifts(
    
    Rafi's avatar
    Rafi committed
    	shift_id INT NOT NULL auto_increment UNIQUE,
        full_date DATE,
        start_time INT,
        end_time INT,
        employee_ID INT,
        PRIMARY KEY (shift_id),
        FOREIGN KEY (employee_ID) REFERENCES Employees(employee_ID)
    
    Rafi's avatar
    Rafi committed
    INSERT INTO Employees (first_name,last_name) VALUES ('Rafi', 'Zereselasie');
    
    select * from Shifts;
    
    drop table Shifts;
    
    
    select * from Employees;
    
    INSERT INTO Employees (first_name,last_name) VALUES ('Rafi', 'Zereselasie');
    
    #create database assignment;
    #USE assignment;
    #create table posts
    #(
    #    tp			varchar(100) NOT NULL,
    #    dt			varchar(100) NOT NULL,
    #    ts			timestamp default current_timestamp on update current_timestamp
    #);
    #INSERT INTO posts (tp,dt) VALUES ('CMPT353', 'NOV 5');
    #select * from posts order by tp desc;
    #show tables;
    #drop table posts;
    #
    -- alter user 'root'@'localhost' identified with mysql_native_password by 'password';
    -- flush privileges;