Skip to content
Snippets Groups Projects
ScheduleApp.sql 1.14 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 Employees;
    
    Rafi's avatar
    Rafi committed
    select * from Shifts;
    
    
    update employees set last_name='fasdfa' where employee_ID=9
    update shifts set full_date="2022-03-12",start_time=900,end_time=1700 where shift_id=1
    
    
    
    drop table Employees;
    
    
    Rafi's avatar
    Rafi committed
    drop table Shifts;
    
    
    
    INSERT INTO Employees (first_name,last_name) VALUES ('Rafi', 'Zereselasie');
    
    
    DELETE FROM shifts WHERE (shift_id = 3)
    DELETE FROM employees WHERE (employee_id = 3)
    
    
    #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;