Q1) Alter your emp table to add a new column password with CHAR(7) datatype. The result should be like below: [image below src__q.png]   Q2).  Please write a DML statement to update password data in your emp table password column. The password data formular should be the first three characters of the ename concates deptno concates the first two digits of empno. The result should be like below:  [image below src__q2.png] [Before DML Statement]

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
100%

Q1) Alter your emp table to add a new column password with CHAR(7) datatype. The result should be like below:

[image below src__q.png]

 

Q2).  Please write a DML statement to update password data in your emp table password column. The password data formular should be the first three characters of the ename concates deptno concates the first two digits of empno. The result should be like below: 

[image below src__q2.png]

[Before DML Statement]

 

Martial needed to answer the questions above:

  • https://drive.google.com/file/d/14OwWDIybjAIeuHCO7McupV08gJs9nB-8/view?usp=sharing
  • https://drive.google.com/file/d/1npRH8JoJ6GYBzPU3iNjLXluvCyhr2tMu/view?usp=sharing
 
[Check your Table Structure Before altering emp]
SQL> DESC emp
Name
Null?
Туре
NOT NULL NUMBER ( 4)
VARCHAR2 (10)
VARCHAR2 (9)
NUMBER ( 4)
EMPNO
ENAME
JÓB
MGR
HIREDATE
DATE
NUMBER ( 7,2)
NUMBER ( 7,2)
NOT NULL NUMBER (2)
SAL
COMM
DEPTNO
SQL> ALTER TABLE emp ADD(.....);
[Check your Table Structure After altering emp]
SQL> DESC emp
Name
Null?
Туре
EMPNO
NOT NULL NUMBER (4)
ΕΝΜΕ
VARCHAR2 (10)
JOB
VARCHAR2 (9)
MGR
NUMBER (4)
HIREDATE
DATE
NUMBER ( 7,2)
NUMBER (7,2)
NOT NULL NUMBER (2)
SAL
COMM
DEPTNO
PASSWORD
CHAR (7)
Transcribed Image Text:[Check your Table Structure Before altering emp] SQL> DESC emp Name Null? Туре NOT NULL NUMBER ( 4) VARCHAR2 (10) VARCHAR2 (9) NUMBER ( 4) EMPNO ENAME JÓB MGR HIREDATE DATE NUMBER ( 7,2) NUMBER ( 7,2) NOT NULL NUMBER (2) SAL COMM DEPTNO SQL> ALTER TABLE emp ADD(.....); [Check your Table Structure After altering emp] SQL> DESC emp Name Null? Туре EMPNO NOT NULL NUMBER (4) ΕΝΜΕ VARCHAR2 (10) JOB VARCHAR2 (9) MGR NUMBER (4) HIREDATE DATE NUMBER ( 7,2) NUMBER (7,2) NOT NULL NUMBER (2) SAL COMM DEPTNO PASSWORD CHAR (7)
SQL> SELECT * FROM emp;
EMPNO ENAME
JOB
MGR HIREDATE
SAL
COMM
DEPTNO PASSWOR
7839 KING
PRESIDENT
17-NOV-81
5000
10
7698 BLAKE
MANAGER
7839 01-MAY-81
2850
30
7782 CLARK
MANAGER
7839 09-JUN-81
2450
10
7566 JONES
MANAGER
7839 02-APR-81
2975
20
7654 MARTIN
SALESMAN
7698 28-SEP-81
1250
1400
30
7499 ALLEN
SALESMAN
7698 20-FEB-81
1600
300
30
7844 TURNER
SALESMAN
7698 08-SEP-81
1500
30
7900 JAMES
CLERK
7698 03-DEC-81
950
30
7521 WARD
SALESMAN
7698 22-FEB-81
1250
500
30
7902 FORD
ANALYST
7566 03-DEC-81
3000
20
7369 SMITH
CLERK
7902 17-DEC-80
800
20
7788 SCOTT
ANALYST
7566 09-DEC-82
3000
20
7876 ADAMS
CLERK
7788 12-JAN-83
1100
20
7934 MILLER
CLERK
7782 23-JAN-82
1300
10
SQL> UPDATE emp
SET password = ..;
[After DML Statement]
SQL> SELECT * FROM emp;
ΕMPNO ΕΝΑΜΕ
JOB
MGR HIREDATE
SAL
COMM
DEPTNO PASSWOR
7839 KING
PRESIDENT
17-NOV-81
5000
10 KIN1078
7698 BLAKE
MANAGER
7839 01-MAY-81
2850
30 BLA3076
7782 CLARK
MANAGER
7839 09-JUN-81
2450
10 CLA1077
7566 JONES
MANAGER
7839 02-APR-81
2975
20 JON2075
7654 MARTIN
SALESMAN
7698 28-SEP-81
1250
1400
30 MAR3076
7499 ALLEN
SALESMAN
7698 20-FEB-81
1600
300
30 ALL3074
7844 TURNER
SALESMAN
7698 08-SEP-81
1500
30 TUR3078
7900 JAMES
CLERK
7698 03-DEC-81
950
30 JAM3079
7521 WARD
SALESMAN
7698 22-FEB-81
1250
500
30 WAR3075
7902 FORD
ANALYST
7566 03-DEC-81
3000
20 FOR2079
7369 SMITH
CLERK
7902 17-DEC-80
800
20 SMI2073
7788 SCOTT
ANALYST
7566 09-DEC-82
3000
20 SC02077
7876 ADAMS
CLERK
7788 12-JAN-83
1100
20 ADA2078
7934 MILLER
CLERK
7782 23-JAN-82
1300
10 MIL1079
Transcribed Image Text:SQL> SELECT * FROM emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO PASSWOR 7839 KING PRESIDENT 17-NOV-81 5000 10 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7844 TURNER SALESMAN 7698 08-SEP-81 1500 30 7900 JAMES CLERK 7698 03-DEC-81 950 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7369 SMITH CLERK 7902 17-DEC-80 800 20 7788 SCOTT ANALYST 7566 09-DEC-82 3000 20 7876 ADAMS CLERK 7788 12-JAN-83 1100 20 7934 MILLER CLERK 7782 23-JAN-82 1300 10 SQL> UPDATE emp SET password = ..; [After DML Statement] SQL> SELECT * FROM emp; ΕMPNO ΕΝΑΜΕ JOB MGR HIREDATE SAL COMM DEPTNO PASSWOR 7839 KING PRESIDENT 17-NOV-81 5000 10 KIN1078 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 BLA3076 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 CLA1077 7566 JONES MANAGER 7839 02-APR-81 2975 20 JON2075 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 MAR3076 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 ALL3074 7844 TURNER SALESMAN 7698 08-SEP-81 1500 30 TUR3078 7900 JAMES CLERK 7698 03-DEC-81 950 30 JAM3079 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 WAR3075 7902 FORD ANALYST 7566 03-DEC-81 3000 20 FOR2079 7369 SMITH CLERK 7902 17-DEC-80 800 20 SMI2073 7788 SCOTT ANALYST 7566 09-DEC-82 3000 20 SC02077 7876 ADAMS CLERK 7788 12-JAN-83 1100 20 ADA2078 7934 MILLER CLERK 7782 23-JAN-82 1300 10 MIL1079
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

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