mysql update data chap 6

13
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.’

Upload: xorg

Post on 22-Nov-2014

1.582 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: MySQL Update Data Chap 6

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.

Page 2: MySQL Update Data Chap 6

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.

Page 3: MySQL Update Data Chap 6

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.

Page 4: MySQL Update Data Chap 6

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

Page 5: MySQL Update Data Chap 6

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.

Page 6: MySQL Update Data Chap 6

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.

Page 7: MySQL Update Data Chap 6

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.

Page 8: MySQL Update Data Chap 6

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;

Page 9: MySQL Update Data Chap 6

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.

Page 10: MySQL Update Data Chap 6

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.

Page 11: MySQL Update Data Chap 6

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.

Page 12: MySQL Update Data Chap 6

10. Changing the boat name column to 60 characters.

11. Changing structure to reject nulls.

12. Drop a table.