Question
Creating a MySQL database and having trouble with this problem any help is appreciated.

a. Tasks Description 1. Update table room to set the value of column roomtype equal to the corresponding id value in the tabl
Tasks Description 1. Update table room to set the value of column roomtype equal to the corresponding id value in the table r
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) As you need to update so I guess it has to look like this:

UPDATE room

SET roomtype = CASE RoomDesc

WHEN 'Critical' THEN 1

WHEN 'Private' THEN 2

WHEN 'Semi-Private' THEN 3

END

2) Just follow the basic syntax in this part:

alter table room alter column roomtype int

3) I am assuming that roomtype and colmnid both are two different table so you have to assign foreign key to each

ALTER TABLE room
ADD FOREIGN KEY (roomType) REFERENCES roomType(roomtype);

Add a comment
Know the answer?
Add Answer to:
Creating a MySQL database and having trouble with this problem any help is appreciated. a. Tasks...
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
  • I'm having a bit of trouble setting up a command for this, any tips? (MySQL) Update...

    I'm having a bit of trouble setting up a command for this, any tips? (MySQL) Update table room to set the value of column roomtype equal to the corresponding id value in the table roomtype. This requires a select * from roomtype; to see what the id value is for each roomDesc. For example, in my database a. 1 | Critical b. 2 | Private c. 3 | Semi-Private I think i need to use a Join but I'm not...

  • SQL Query Question: I have a database with the tables below, data has also been aded...

    SQL Query Question: I have a database with the tables below, data has also been aded into these tables, I have 2 tasks: 1. Add a column to a relational table POSITIONS to store information about the total number of skills needed by each advertised position. A name of the column is up to you. Assume that no more than 9 skills are needed for each position. Next, use a single UPDATE statement to set the values in the new...

  • Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make t...

    Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make the following modifications: For the vendors table: Comment out the table-level primary key Change the VendorIDcolumn to be a column-level primary key Add a VendorEmail column to the bottom of the table definition (define the data type for the column as variable character and set it to not exceed 45 characters) After the lineItems table, add code to create a table...

  • Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accoun...

    Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accounting, and employee data, and these different data sets must all be efficiently managed in order to make the data accessible. Companies rely on database engineers to ensure that their records are accurate, updated, and tracked in real time. This course covers structured query language (SQL) and how it can be used to manage database schemas, manipulate data, and analyze data. For your final...

  • I NEED TO WRITE THE FOLLOWING QUERIES IN MYSQL (13)Next, grant to a user admin the read privileges on the complete descr...

    I NEED TO WRITE THE FOLLOWING QUERIES IN MYSQL (13)Next, grant to a user admin the read privileges on the complete descriptions of the customers who submitted no orders. For example, these are the customers who registered themselves and submitted no orders so far. The granted privilege cannot be propagated to the other users. 0.3 (14)Next, grant to a user admin the read privileges on information about the total number of orders submitted by each customer. Note, that some customers...

  • Subject: Database Notes: Please give me detailed answers so I could learn from this. Thank you....

    Subject: Database Notes: Please give me detailed answers so I could learn from this. Thank you. PS: This is a homework that I already submitted but did not know whether my answer is right or wrong. Pasien=Patient, namaLengkap=FullName, ibuKandung=biologicalMother, tglLahir=birthDate, alamat=address, dokter=doctor, spesialisasi=specialization, taripkonsul=consultingFee, ranap=inpatient, wktMasuk=enterTime, idRuang=idRoom, ruang=room, namaRuang=roomName, biaya=fee, wktKeluar=outTime, to explain some questions given below. pasienfidPasien varchar, namalengkap varchar, bukandung varchar, tgl Lahir date, alamat varchar) . dokter(idDr varchar, nama Lengkap varchar, spesialisasi varchar, tarip.per konsul UNSIGNED INT)...

  • 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...

  • Connect to mySQL DBMS, open a SQL script file, navigate to CityJail.sql file and execute it...

    Connect to mySQL DBMS, open a SQL script file, navigate to CityJail.sql file and execute it to create tables and populate with the supplied data. If there are any errors in the script fix them. It is your job to find the errors and correct them. This is important. You will need correct data for future exercises in this module. Then answer all questions. Write the answer below each question then take screen shot of the result. This script builds...

  • Database HW help!!!!!!! Provide the SQL statements for the following queries. (1) Provide the names and...

    Database HW help!!!!!!! Provide the SQL statements for the following queries. (1) Provide the names and phones of all swimmers currently in level (of id) 3. +-------+---------+---------------------------+ | FName | LName   | EMail                     | +-------+---------+---------------------------+ | Bobby | Khan    | theBKhan1 | | Clara | Johnson | ClaraJohnson_11 | +-------+---------+---------------------------+ 2 rows in set (0.00 sec) (2) Provide the names of swimmers who have signed up to participate in the event '100M Butterfly' of Meet id 1. +-------+---------+ | FName...

  • Write the following SQL statements in Microsoft Access by using the Books database from Week 2...

    Write the following SQL statements in Microsoft Access by using the Books database from Week 2 Assignment 2. Once complete, copy and paste the SQL statements in a Microsoft Word document: Write SQL statements: To update the publisher name from READ WITH US to READ FOR US To verify the updated name field for the publisher with ID 6 To make the following updates to the Publisher table (be careful with WHERE): Make Contact="John Travolta" for publisher with ID number...

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
ADVERTISEMENT