For the table definition below, write a SQL UPDATE statement that changes all annual salaries to monthly salaries. CREATE TABLE Worker (     WORKER_ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,     FIRST_NAME TEXT,     LAST_NAME TEXT,     SALARY DOUBLE,     JOINING_DATE DATETIME,     DEPARTMENT CHAR(25) );

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

For the table definition below, write a SQL UPDATE statement that changes all annual salaries to monthly salaries.

CREATE TABLE Worker (
    WORKER_ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    FIRST_NAME TEXT,
    LAST_NAME TEXT,
    SALARY DOUBLE,
    JOINING_DATE DATETIME,
    DEPARTMENT CHAR(25)
); 

The image contains SQL code for managing a database related to workers, bonuses, and their job titles. Here is a detailed transcription and explanation:

### SQL Code and Structure

1. **Dropping and Creating Tables:**

   - **Worker Table:**
     ```sql
     DROP TABLE IF EXISTS Worker;
     CREATE TABLE Worker (
         WORKER_ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
         FIRST_NAME TEXT,
         LAST_NAME TEXT,
         SALARY INTEGER(15),
         JOINING_DATE DATETIME,
         DEPARTMENT CHAR(25)
     );
     ```

   This section removes the "Worker" table if it exists and creates a new "Worker" table with the following fields:
   - `WORKER_ID`: A unique identifier with auto-increment.
   - `FIRST_NAME` and `LAST_NAME`: The worker's name.
   - `SALARY`: A numerical field indicating the salary.
   - `JOINING_DATE`: The date and time the worker joined.
   - `DEPARTMENT`: The department in which the worker operates.

2. **Inserting Data into Worker Table:**
   ```sql
   INSERT INTO Worker (WORKER_ID, FIRST_NAME, LAST_NAME, SALARY, JOINING_DATE, DEPARTMENT) VALUES
   (001, 'Monika', 'Arora', 100000, '14-02-20 09.00.00', 'HR'),
   ...
   (008, 'Geetika', 'Chauhan', 90000, '14-04-11 09.00.00', 'Admin');
   ```

   This inserts several records into the "Worker" table, providing specific details for each worker.

3. **Bonus Table:**
   ```sql
   DROP TABLE IF EXISTS Bonus;
   CREATE TABLE Bonus (
       WORKER_REF_ID INTEGER,
       BONUS_AMOUNT INTEGER(10),
       BONUS_DATE DATETIME,
       FOREIGN KEY (WORKER_REF_ID)
           REFERENCES Worker(WORKER_ID)
           ON DELETE CASCADE
   );
   ```

   Similar to the "Worker" table, this part creates a "Bonus" table:
   - `WORKER_REF_ID`: References the `WORKER_ID` from the "Worker" table.
   - `BONUS_AMOUNT`: The bonus amount granted.
   - `BONUS_DATE`: Date when the bonus was given.

   The foreign key ensures bonuses are linked to existing workers and applies cascading deletions.
Transcribed Image Text:The image contains SQL code for managing a database related to workers, bonuses, and their job titles. Here is a detailed transcription and explanation: ### SQL Code and Structure 1. **Dropping and Creating Tables:** - **Worker Table:** ```sql DROP TABLE IF EXISTS Worker; CREATE TABLE Worker ( WORKER_ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, FIRST_NAME TEXT, LAST_NAME TEXT, SALARY INTEGER(15), JOINING_DATE DATETIME, DEPARTMENT CHAR(25) ); ``` This section removes the "Worker" table if it exists and creates a new "Worker" table with the following fields: - `WORKER_ID`: A unique identifier with auto-increment. - `FIRST_NAME` and `LAST_NAME`: The worker's name. - `SALARY`: A numerical field indicating the salary. - `JOINING_DATE`: The date and time the worker joined. - `DEPARTMENT`: The department in which the worker operates. 2. **Inserting Data into Worker Table:** ```sql INSERT INTO Worker (WORKER_ID, FIRST_NAME, LAST_NAME, SALARY, JOINING_DATE, DEPARTMENT) VALUES (001, 'Monika', 'Arora', 100000, '14-02-20 09.00.00', 'HR'), ... (008, 'Geetika', 'Chauhan', 90000, '14-04-11 09.00.00', 'Admin'); ``` This inserts several records into the "Worker" table, providing specific details for each worker. 3. **Bonus Table:** ```sql DROP TABLE IF EXISTS Bonus; CREATE TABLE Bonus ( WORKER_REF_ID INTEGER, BONUS_AMOUNT INTEGER(10), BONUS_DATE DATETIME, FOREIGN KEY (WORKER_REF_ID) REFERENCES Worker(WORKER_ID) ON DELETE CASCADE ); ``` Similar to the "Worker" table, this part creates a "Bonus" table: - `WORKER_REF_ID`: References the `WORKER_ID` from the "Worker" table. - `BONUS_AMOUNT`: The bonus amount granted. - `BONUS_DATE`: Date when the bonus was given. The foreign key ensures bonuses are linked to existing workers and applies cascading deletions.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Query Syntax
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education