mysql update data chap 6

Post on 22-Nov-2014

1.582 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1. First: insert the same columns from the part table.

2. Second table. I used the INSERT INTO NONAPPLIANCE followed by the SELECT clause.

3. Third table. The upper table contains with no updates, but the second it has the “Deluxe Iron.’

4. The fourth table.

This table is not altered (upper table) the table below contains the updated rows.

5. The fifth table. The first table below show with the row that I added.

This is what I used.

6. The sixth table.

7. The seventh table.

The actual table is below.

8. Adding a column named ONHANDVALUE to the NONAPPLIANCE table.

9. Increasing the length of the description columns to 30 characters.

The syntax I used to alter was.

10. Dropping the table. I used the drop command and I show the tables. Since the nonappliance table was removed, it is not showing.

HENRY BOOK1. Create the mystery table

2. Inserting into the mystery table the values/columns from the book table.

The syntax I used upper image, and table shown below is the result.

3. Updating the price in the mystery table accordingly. The formula I used was Price = Price –(price * .4);

4. Inserting a new table into the mystery table.

5. Deleting a book in the mystery.

6. The price of a book has increased to an unknown.

The table is show below.

7. Adding a column named best seller. First I created a table and them added the N.Alternative way is alter table mystery add mystery char(1);

8. Changing the bestseller column in the mystery table.

The table is show below

9. Changing the length on the title column to 50 characters.The alternative is alter table mystery modify title char(50);

The syntax that I used is below.

10. Altering to not nulls in the bestseller

11. Dropping a table or the table.

ALEXAMARA1. Creating tables with two primary keys.

2. Adding some rows from the marina slip table into the largest slip table. I had a problem with the primary key. I tried transferring all values from marina slip to large slip but since me the marinaslip the slipnum did allow null and did not in the largest slip table. I had to use the ALTER TABLE LARGESLIP MODIFY SLIPNUM DECIMAL(4,0) NOT NULL;

3. Updating the rental free in the Alexamara table by $100.

4. Decrease the rental fee of any slip whose fee is more than 4000 by 1.

The old values are here below.

5. Inserting a new slip into the large Slip.

6. Delete all slips in the large Slip with owner number TR72.

7. Changing to unknown.

8. Adding a new charter column into the largeslip table and setting to N. The alternative way of doing was or is to use the Alter table LargeSlip update

9. Changing charter columns to N based on criteria.

10. Changing the boat name column to 60 characters.

11. Changing structure to reject nulls.

12. Drop a table.

top related