For each of the following commands, how many rows are affected (updated, deleted, or inserted)? If the command causes an error, the number of affected rows is 0 (zero). a) DELETE FROM employees WHERE id = 3; [ Select ] 9 WHERE code = 2; [ Select] b) UPDATE jobs SET code %3D [ Select ] 8; %3D c) DELETE FROM jobs WHERE code d) INSERT INTO employees (name, job_code) VALUES ('Pluto', 10); IColect1

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
The image shows a MySQL database query example with two tables: "employees" and "jobs." 

Tables:
1. **employees**: Contains columns id (primary key), name, and job_code (foreign key referencing the jobs table).
2. **jobs**: Contains columns code (primary key), title, and salary.

### Employees Table Data:
- **Columns**: 
  - `id`: Employee identifier (integer).
  - `name`: Employee name (string).
  - `job_code`: Code referencing job titles (integer).

- **Data**:
  ```
  +----+---------------+----------+
  | id | name          | job_code |
  +----+---------------+----------+
  |  1 | Captain Hook  |        1 |
  |  2 | Tiger Lily    |        1 |
  |  3 | Pocahontas    |        1 |
  |  4 | Meeko         |        4 |
  |  5 | Woody         |        1 |
  |  6 | Flik          |        3 |
  |  7 | Dot           |        3 |
  |  8 | Sofia, the First |      3 |
  |  9 | Scully        |        1 |
  | 12 | Olaf          |        4 |
  | 14 | Aladdin       |        3 |
  | 18 | Eeyore        |        1 |
  | 19 | Pooh          |        1 |
  | 20 | Piglet        |        3 |
  | 25 | Scrooge       |        1 |
  +----+---------------+----------+
  ```

- **Query**: 
  ```sql
  SELECT * FROM employees;
  ```
- **Output**: 15 rows returned, showing a list of employees' names paired with their respective job codes.

### Jobs Table Data:
- **Columns**: 
  - `code`: Job code identifier (integer).
  - `title`: Job title (string).
  - `salary`: Salary for the job (decimal).

- **Data**:
  ```
  +------+---------+--------+
  | code | title   | salary |
  +------+---------+--------+
  |    1 | author  | 100.50 |
  |    2 | editor  |
Transcribed Image Text:The image shows a MySQL database query example with two tables: "employees" and "jobs." Tables: 1. **employees**: Contains columns id (primary key), name, and job_code (foreign key referencing the jobs table). 2. **jobs**: Contains columns code (primary key), title, and salary. ### Employees Table Data: - **Columns**: - `id`: Employee identifier (integer). - `name`: Employee name (string). - `job_code`: Code referencing job titles (integer). - **Data**: ``` +----+---------------+----------+ | id | name | job_code | +----+---------------+----------+ | 1 | Captain Hook | 1 | | 2 | Tiger Lily | 1 | | 3 | Pocahontas | 1 | | 4 | Meeko | 4 | | 5 | Woody | 1 | | 6 | Flik | 3 | | 7 | Dot | 3 | | 8 | Sofia, the First | 3 | | 9 | Scully | 1 | | 12 | Olaf | 4 | | 14 | Aladdin | 3 | | 18 | Eeyore | 1 | | 19 | Pooh | 1 | | 20 | Piglet | 3 | | 25 | Scrooge | 1 | +----+---------------+----------+ ``` - **Query**: ```sql SELECT * FROM employees; ``` - **Output**: 15 rows returned, showing a list of employees' names paired with their respective job codes. ### Jobs Table Data: - **Columns**: - `code`: Job code identifier (integer). - `title`: Job title (string). - `salary`: Salary for the job (decimal). - **Data**: ``` +------+---------+--------+ | code | title | salary | +------+---------+--------+ | 1 | author | 100.50 | | 2 | editor |
**Database Operation Exercise**

The table displayed represents a list of employees with their corresponding job title and salary. The table includes the following columns: `id`, `title`, and `salary`. Here are the entries:

```
+------+---------+--------+
| id   | title   | salary |
+------+---------+--------+
| 1    | author  | 100.50 |
| 2    | editor  | 200.00 |
| 3    | manager | 150.00 |
| 4    | student | 0.00   |
| 8    | CFO     | 250.00 |
+------+---------+--------+
```

The exercise below is about understanding SQL commands and identifying how many rows each command affects. If a command causes an error, the number of affected rows is considered to be zero.

**Commands:**

a) `DELETE FROM employees WHERE id = 3;`
   - This command deletes the row where `id` is 3.

b) `UPDATE jobs SET code = 9 WHERE code = 2;`
   - This command updates the rows in the `jobs` table, setting `code` to 9 where the current `code` is 2.

c) `DELETE FROM jobs WHERE code = 8;`
   - This command deletes rows from the `jobs` table where the `code` is 8.

d) `INSERT INTO employees (name, job_code) VALUES ('Pluto', 10);`
   - This command inserts a new employee with the name 'Pluto' and `job_code` 10 into the `employees` table.

For each of the above commands, determine how many rows are affected and note your answer in the provided selection box.
Transcribed Image Text:**Database Operation Exercise** The table displayed represents a list of employees with their corresponding job title and salary. The table includes the following columns: `id`, `title`, and `salary`. Here are the entries: ``` +------+---------+--------+ | id | title | salary | +------+---------+--------+ | 1 | author | 100.50 | | 2 | editor | 200.00 | | 3 | manager | 150.00 | | 4 | student | 0.00 | | 8 | CFO | 250.00 | +------+---------+--------+ ``` The exercise below is about understanding SQL commands and identifying how many rows each command affects. If a command causes an error, the number of affected rows is considered to be zero. **Commands:** a) `DELETE FROM employees WHERE id = 3;` - This command deletes the row where `id` is 3. b) `UPDATE jobs SET code = 9 WHERE code = 2;` - This command updates the rows in the `jobs` table, setting `code` to 9 where the current `code` is 2. c) `DELETE FROM jobs WHERE code = 8;` - This command deletes rows from the `jobs` table where the `code` is 8. d) `INSERT INTO employees (name, job_code) VALUES ('Pluto', 10);` - This command inserts a new employee with the name 'Pluto' and `job_code` 10 into the `employees` table. For each of the above commands, determine how many rows are affected and note your answer in the provided selection box.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 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
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