n the query below, what is the difference between INTEGER ad INTEGER(15)? Why is it used? 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) ); View keyboard shortcuts

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
Question

In the query below, what is the difference between INTEGER ad INTEGER(15)? Why is it used?

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)
);

View keyboard shortcuts
 
 
 
 
 
 
 

 

## SQL Database Schema Creation and Data Insertion

This script demonstrates the creation of a simple relational database schema involving `Worker`, `Bonus`, and `Title` tables, illustrating fundamental operations such as table creation, deletion, and data insertion.

### Worker Table

1. **Table Creation:**
   - The `Worker` table is created with the following columns:
     - `WORKER_ID`: Integer, Primary Key, Auto-incremented.
     - `FIRST_NAME`: Text.
     - `LAST_NAME`: Text.
     - `SALARY`: Integer (15).
     - `JOINING_DATE`: DateTime.
     - `DEPARTMENT`: Character (25).

2. **Data Insertion:**
   - Records are inserted into the `Worker` table with worker details such as IDs, names, salaries, joining dates, and departments.

### Bonus Table

1. **Table Creation:**
   - The `Bonus` table is created with:
     - `WORKER_REF_ID`: Integer, Foreign Key referencing `WORKER_ID` in `Worker` table.
     - `BONUS_AMOUNT`: Integer (10).
     - `BONUS_DATE`: DateTime.
     - Includes `ON DELETE CASCADE` to automatically delete related bonuses if a worker is deleted.

2. **Data Insertion:**
   - Records are inserted linking workers to bonus amounts and dates on which bonuses were given.

### Title Table

1. **Table Creation:**
   - The `Title` table includes:
     - `WORKER_REF_ID`: Integer, Foreign Key referencing `WORKER_ID` in `Worker` table.
     - `WORKER_TITLE`: Variable Character (64).
     - `AFFECTED_FROM`: DateTime.

2. **Data Insertion:**
   - Records are inserted to track the titles held by workers over time.

### Summary

This SQL script provides an example of managing employee data with related tables for bonuses and titles. Key concepts include foreign key relationships for data integrity, employing `ON DELETE CASCADE` for dependent data handling, and structured data insertion.
Transcribed Image Text:## SQL Database Schema Creation and Data Insertion This script demonstrates the creation of a simple relational database schema involving `Worker`, `Bonus`, and `Title` tables, illustrating fundamental operations such as table creation, deletion, and data insertion. ### Worker Table 1. **Table Creation:** - The `Worker` table is created with the following columns: - `WORKER_ID`: Integer, Primary Key, Auto-incremented. - `FIRST_NAME`: Text. - `LAST_NAME`: Text. - `SALARY`: Integer (15). - `JOINING_DATE`: DateTime. - `DEPARTMENT`: Character (25). 2. **Data Insertion:** - Records are inserted into the `Worker` table with worker details such as IDs, names, salaries, joining dates, and departments. ### Bonus Table 1. **Table Creation:** - The `Bonus` table is created with: - `WORKER_REF_ID`: Integer, Foreign Key referencing `WORKER_ID` in `Worker` table. - `BONUS_AMOUNT`: Integer (10). - `BONUS_DATE`: DateTime. - Includes `ON DELETE CASCADE` to automatically delete related bonuses if a worker is deleted. 2. **Data Insertion:** - Records are inserted linking workers to bonus amounts and dates on which bonuses were given. ### Title Table 1. **Table Creation:** - The `Title` table includes: - `WORKER_REF_ID`: Integer, Foreign Key referencing `WORKER_ID` in `Worker` table. - `WORKER_TITLE`: Variable Character (64). - `AFFECTED_FROM`: DateTime. 2. **Data Insertion:** - Records are inserted to track the titles held by workers over time. ### Summary This SQL script provides an example of managing employee data with related tables for bonuses and titles. Key concepts include foreign key relationships for data integrity, employing `ON DELETE CASCADE` for dependent data handling, and structured data insertion.
Expert Solution
Step 1

INTEGER in SQL means the data to be stored in a particular field is an integer value.

 

INTEGER (INT) is a numeric value without a decimal. 

 

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
SQL Query
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
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