MY CODE >> Mobile Database
CREATE DATABASE SMART_HOMES_MOBILE_DATABASE;

USE SMART_HOMES_MOBILE_DATABASE;

CREATE TABLE USER_ACCOUNT
    (
    AccountID              Int         NOT NULL    AUTO_INCREMENT,
    EmailAddress        Char(50)    NOT NULL,
    LastName            Char(25)    NOT NULL,
    FirstName           Char(12)    NOT NULL,
    
    CONSTRAINT          DEPARTMENT_PK   PRIMARY KEY (AccountID)
    );
    
CREATE TABLE DEVICE
    (
    DeviceID            Int         NOT NULL    AUTO_INCREMENT,
    AccountID              Int         NOT NULL,
    
    CONSTRAINT          DEVICE_PK       PRIMARY KEY (DeviceID),
    CONSTRAINT          DEVI_ACC_FK    FOREIGN KEY (AccountID)
                        REFERENCES      USER_ACCOUNT (AccountID)
                        ON UPDATE RESTRICT
                        ON DELETE RESTRICT
    );

CREATE TABLE DEVICE_LOCATION
    (
    LocationID          Int         NOT NULL    AUTO_INCREMENT,
    Location            Char(25)    NOT NULL,
    DeviceID            Int         NOT NULL,
    
    CONSTRAINT          DEVICE_LOCATION_PK  PRIMARY KEY (LocationID),
    CONSTRAINT          LOCA_DEVI_FK        FOREIGN KEY (DeviceID)
                        REFERENCES          DEVICE (DeviceID)
                        ON UPDATE RESTRICT
                        ON DELETE RESTRICT
    );

CREATE TABLE PROGRAMMABLE_DATA
    (
    ScheduleID          Int         NOT NULL    AUTO_INCREMENT,
    Temperature         Numeric(3)  NOT NULL,
    ScheduledStartTime   Time        NOT NULL,
    ScheduledStopTime    Time        NOT NULL,
    DeviceID            Int         NULL,
    
    CONSTRAINT          PROGRAMMABLE_DATA_PK    PRIMARY KEY (ScheduleID),
    CONSTRAINT          PROG_DEVI_FK            FOREIGN KEY (DeviceID)
                        REFERENCES              DEVICE (DeviceID)
                        ON UPDATE RESTRICT
                        ON DELETE RESTRICT
    );