Question

In: Computer Science

Question 3. Issue the following statement to create a copy of the d_clients table named d_clients_copy...

Question 3. Issue the following statement to create a copy of the d_clients table named d_clients_copy and write ONE statement to update this table. create table d_clients_copy as select * from d_cliens Change the phone number for Hiram Peters to 5551212 and email to [email protected]

Solutions

Expert Solution

Hello,

Good Day!

/* Create a table called  d_clients*/
CREATE TABLE d_clients(Name varchar(20), Phone int, email varchar(50));

/* Inserting records in to table d_clients */
INSERT INTO d_clients VALUES('Hiram Peters',5551210,'[email protected]');

/* Display all the records from the table */
SELECT * FROM d_clients;

Output:

Hiram Peters|5551210|[email protected]

Solution:

/*create a copy of the d_clients table named d_clients_copy and write ONE statement to update this table. create table d_clients_copy as select * from d_cliens Change the phone number for Hiram Peters to 5551212 and email to [email protected] */

create table d_clients([name] varchar(20),phone int,email varchar(50));
insert into d_clients ([name],phone,email) values('Hiram Peter',5551210,'[email protected]');
insert into d_clients ([name],phone,email) values('David',5551211,'[email protected]');
select * from d_clients;


select [name],case when[name]='Hiram Peter' then 5551212 else phone end AS phone,email into d_clients_copy from d_clients;
select * from d_clients_copy;

This query will create table d_clients_copy with d_clients skeleton and the value of the one record in the table will be replaced with phone 5551212 and email "[email protected]".

Thank you!


Related Solutions

1. Write the statements to create a table named REQUIREMENTS. The table has the following columns:...
1. Write the statements to create a table named REQUIREMENTS. The table has the following columns: credits number (primary key) and degree name. 2. Write the statements to create a table named CANDIDATE with the following columns names. Pick the best column type: student_id, first name, last name, credits and graduation date. The credits column is a foreign key to the credits column in the REQUIREMENTS table. 3. Write the statement(s) to Insert 2 rows in your REQUIREMENTS table. Make...
Consider the following SQL script. QUESTION: Which best completes the following statement(Select 3): Table SELECT TABLE...
Consider the following SQL script. QUESTION: Which best completes the following statement(Select 3): Table SELECT TABLE NAME is in SELECT NORMAL FORM and is SELECT FORM TYPE ***Note: The answer choices are at the bottom Assume also that even if there are some issues you cannot resolve them. Report on the current state of the database based on the code that you have been provided. CREATE TABLE ASSIGNMENT ( ASSIGN_NUM int, ASSIGN_DATE datetime, PROJ_NUM varchar(3), EMP_NUM varchar(3), ASSIGN_HOURS float(8), ASSIGN_CHG_HOUR...
Create a new table named CUSTOMER_STATUS.The table will hold the Customer_Status_Id and the Customer_Status_Description with possible...
Create a new table named CUSTOMER_STATUS.The table will hold the Customer_Status_Id and the Customer_Status_Description with possible values: Inactive, Active, Very_Active These values will be used to characterize the customers so that:                   Inactive Customers => Have 0 orders                   Active Customers => Have between 1 and 3 orders Very Active Customers => Have 4 or more orders
Create a Python Module named piphash_rainbow.py that Creates a rainbow table named sixdigithash_rainbow.csv that stores all...
Create a Python Module named piphash_rainbow.py that Creates a rainbow table named sixdigithash_rainbow.csv that stores all possible six-digit pins and their corresponding md5, sha1, sha256, and sha512 hashes.
Question: In a package named "oop" create a Scala class named "Team" and a Scala object...
Question: In a package named "oop" create a Scala class named "Team" and a Scala object named "Referee". Team will have: • State values of type Int representing the strength of the team's offense and defense with a constructor to set these values. The parameters for the constructor should be offense then defense • A third state variable named "score" of type Int that is not in the constructor, is declared as a var, and is initialized to 0 Referee...
do the following SQL programming tasks: Use the CREATE TABLE statement to build the sample table...
do the following SQL programming tasks: Use the CREATE TABLE statement to build the sample table (MODULE) Use the INSERT INTO statement to populate it - use either the data in the image or your own Write an SQL query to display the whole populated table Write an SQL query to display certain combinations of columns (use your imagination) Write an SQL query to extract certain combinations of columns and rows (imagination again!)
In a package named "oop" create a Scala class named "Score" with the following: • A...
In a package named "oop" create a Scala class named "Score" with the following: • A constructor that takes an Int and stores it in a member variable named score • A method named scoreGoal that takes no parameters and has return type Unit that increments the score by 1 • A method named isWinner that takes a Score object as a parameter and returns a Boolean. The method returns true if this instances score is strictly greater than the...
Use a single SQL statement to create a relational table and to load into the table...
Use a single SQL statement to create a relational table and to load into the table department name, subject code, year of running and session of running that offered by the departments. Note that a running subject offered by a department means a lecturer of the department has been assigned to teach the subject. Next, enforce the appropriate consistency constraints on the new table.    When ready use SELECT statement to list the contents of the relational table created and...
3. Write the statements to: • create a user named FooBar with a password of “candybar”...
3. Write the statements to: • create a user named FooBar with a password of “candybar” • assign the payments role created in the previous question to FooBar • assign the create session privilege to FooBar • Show the statements to connect to FooBar 4. For this question, I only need the query statement and not the results. Write the queries that use the user_sys_privs, user_tab_privs, user_role_privs, role_sys_privs and role_tab_privs objects to view the user and role privileges that are...
USING SQL Create a table named Zones with the attributes and assumptions indicated below. Attributes: the...
USING SQL Create a table named Zones with the attributes and assumptions indicated below. Attributes: the zone ID, the lowest and the highest accepted temperature. Assumptions: the ID will be the primary key and have one or two digits, the temperatures (in Fahrenheit) will be at most two digits and a possible minus sign, none of the temperatures can be NULL. Populate table Zones so that it has the following rows: id lowerTemp higherTemp 2 -50 -40 3 -40 -30...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT