Question

there is a table EMPLOYEE contains 3 columns (name, email, job) in sql: +--------------------------+--------------------------------------------+-----------+ | name...

there is a table EMPLOYEE contains 3 columns (name, email, job) in sql:

+--------------------------+--------------------------------------------+-----------+
| name | email | job     |
+--------------------------+--------------------------------------------+-----------+
| Jack Smith   | [Jack11@abcd.com]    | Teacher    |
| Rock Jol    | [Rock.jol@jfhro.com]    | cashier |
| Andrew stanley | [ANDREW80@hfwjs.com] | student    |
+--------------------------+--------------------------------------------+-----------+

create second table EMPLOYEE2 which has three columns as follows (in sql):

Jack Smith   Jack11@abcd.com Teacher

Hint: can use update EMPLOYEE2 set email = ....

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

Creating employee table and inserting rows:

create table employee(name char(100),email varchar(100),job char(20));

insert into employee values ("Jack Smith","[Jack11@abcd.com]","Teacher"),("Rock Jol","[Rock.jol@fhro.com]","cashier"),("Andrew Stanley","[ANDREW80@hfwjs.com]","student");

Creating employee2 table:

create table employee2(name char(100),email varchar(100),job char(20));

Here insert rows into employee2 table from employee table by removing bracets [] in email column.By using substr() function we can achieve that task.

Inserting rows to employee2 table:

insert into employee2 (name,email,job) select name,substr(email,2,length(email)-2),job from employee;

Here substr() function takes the email string from 2nd index and then it will extract length(email)-2 characters it will give last before position of the string.

Code and Output Screenshots:

mysql> create table employee(name char(100), email varchar(100),job char(20)); Query OK, O rows affected (0.54 sec) mysql> in

Note: if you have any queries please post a comment thanks a lot..always available to help you..

Add a comment
Know the answer?
Add Answer to:
there is a table EMPLOYEE contains 3 columns (name, email, job) in sql: +--------------------------+--------------------------------------------+-----------+ | name...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write SQL authorization statements on the employee table as per the following requirements: Employee (id, name,...

    Write SQL authorization statements on the employee table as per the following requirements: Employee (id, name, job_name, dept_name, salary) - You have three managers with manager1, manager2 and manager3 user ids. All of them are members of the role manager. - All managers have the same privileges: select, insert, update, delete. - No managers can transfer his privileges on the employee table.

  • 1) Write a SQL code in order to create a table name Employee with Emp_ID (3...

    1) Write a SQL code in order to create a table name Employee with Emp_ID (3 characters), Last_Name (20 characters), and First_Name (15 characters), the primary key is Emp_ID (Note: make sure this code will run on SQL view on Access database) 2) Write a SQL code to remove the table Employee that will remove both the structure and the content of the table. (

  • (PL/SQL Programming) Consider the table EMPLOYEE with attributes ID, Name, and Hours, and the table PAYINFO...

    (PL/SQL Programming) Consider the table EMPLOYEE with attributes ID, Name, and Hours, and the table PAYINFO with attributes Regular, Overtime, and HourLimit, defined and populated by the following script: DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE EMPLOYEE (        ID            CHAR(5),        Name          VARCHAR2(16),        Hours         NUMBER(2),        CONSTRAINT PK_EMPLOYEE               PRIMARY KEY (ID) ); INSERT INTO EMPLOYEE VALUES ('22144', 'Anderson', 30); INSERT INTO EMPLOYEE VALUES ('31902', 'Bruford', 45); INSERT INTO EMPLOYEE VALUES ('42771', 'Wakeman', 20); INSERT INTO EMPLOYEE VALUES...

  • solve: Write a single SQL statement to create a new table named Login with five columns:...

    solve: Write a single SQL statement to create a new table named Login with five columns: User(Text), Password (Text), Update (Date), Status (Text) and CustomerID (Integer) Set the default value of LastUpdate to the current date and time ( time) Define a check on Status to make sure the value could either be 'active' or 'inactive' and Write a single SQL statement to list all the tracks that have the exact word 'hello' (including both upper and lower cases) as...

  • DROP TABLE EMPLOYEE; DROP TABLE JOB; DROP TABLE EMP; DROP TABLE EMP_1; DROP TABLE EMP_2; CREATE...

    DROP TABLE EMPLOYEE; DROP TABLE JOB; DROP TABLE EMP; DROP TABLE EMP_1; DROP TABLE EMP_2; CREATE TABLE JOB(JOB_CODE CHAR (3) PRIMARY KEY, JOB_DESCRIPTION VARCHAR (20) NOT NULL,JOB_CHG_HOUR NUMBER (5,2) NOT NULL,JOB_LAST_UPDATE DATE NOT NULL); INSERT INTO JOB VALUES('500','Programmer','35.75','20-Nov-2017'); INSERT INTO JOB VALUES('501','System Analyst','96.75','20-Nov-2017'); INSERT INTO JOB VALUES('502','Database Designer','125.00','24-Mar-2018'); CREATE TABLE EMPLOYEE(EMP_NUM CHAR (3) PRIMARY KEY,EMP_LNAME VARCHAR (15) NOT NULL,EMP_FNAME VARCHAR (15) NOT NULL, EMP_INITIAL CHAR (1),EMP_HIREDATE DATE NOT NULL,JOB_CODE CHAR (3), EMP_YEARS NUMBER (2),FOREIGN KEY (JOB_CODE) REFERENCES JOB (JOB_CODE)); INSERT...

  • Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates...

    Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates to the following tables: • Employee table (project 1) create table Employee ( empNumber char(8) not null, firstName varchar(25) null, lastName varchar(25) null, ssn char(9) null, address varchar(50) null, state char(2) null, zip char(5) null, jobCode char(4) null, dateOfBirth date null, certification bit null, salary money null, constraint PK_EMP PRIMARY KEY(empNumber), constraint EMP_STATECHECK CHECK(state in ('CA','FL')) ) GO • Job table (project 1) create...

  • - - Requirements Building upon your project 1 and project 2, the park will be a Star Wars themed ...

    - - Requirements Building upon your project 1 and project 2, the park will be a Star Wars themed park. You must design additional parts of the database and create the following SQL Script. Step 1: Create table audits via triggers The system must log any insertion, deletion, or updates to the following tables Employee table (project 1) Job table (project 1) ProjectMain table (Project 2) ActivityMain table (Project 2) . . For each one of the table above, you...

  • For this set of Review Questions, we will create and use a database for the Wedgewood...

    For this set of Review Questions, we will create and use a database for the Wedgewood Pacific Corporation (WPC) that is similar to the Microsoft Access database we created and used in Chapters 1 and 2. Founded in 1957 in Seattle, Washington, WPC has grown into an internationally recognized organization. The company is located in two buildings. One building houses the Administration, Accounting, Finance, and Human Resources departments, and the second houses the Production, Marketing, and Information Systems departments. The...

  • 1. Write an Sql statement to display all the columns in the driver table Write an...

    1. Write an Sql statement to display all the columns in the driver table Write an SQL statement to display the name, location, and certified for all drivers that have Certified equal to Y. Sort the results in descending order by driverid 3. Write an SQL statement to display the group the data by driverid so we can find the sum of hours and miles logged from timesheet 4. Write an update statement to set the certified to P for...

  • Q2. Retrieve the names of all employees from the employee table to produce output on CSV...

    Q2. Retrieve the names of all employees from the employee table to produce output on CSV format or delimited format with a common delimeter, rather than separete columns. Hint:Put the whole row into a string with a semicolon as the seperator(delimeter) between thecolumns: FORMAT:(fname;minit;lname) Example: EMPLOYEES -------------- James;E;Borg Frank;T;Wong Q3. Write a query to show the employees name from the employee table in this format: first letter of the first name, followed by a dot, a blank, and the full...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT