Free Newsletters:
DatabaseDaily
 

SQLCourse
Interactive Online SQL Training

Search Database Journal:

HOME News MS SQL Oracle DB2 Access MySQL PHP SQL Etc Scripts Links Forums DBA Talk
SQL Courses
1What is SQL?
2Table basics
3Selecting data
4Creating tables
5Inserting into a table
6Updating records
7Deleting records
8Drop a table
9Advanced Queries
10Standalone SQL interpreter
11Advertise on SQLCourse.com
12Database Links
13Technology Jobs



Updating Records Answers

  1. Jonie Weber just got married to Bob Williams. She has requested that her last name be updated to Weber-Williams.

    update 
     myemployees_ts0211
    set lastname=
      'Weber-Williams' 
    where firstname=
          'Jonie' 
     and lastname=
         'Weber';
  2. Dirk Smith's birthday is today, add 1 to his age.

    update myemployees_ts0211
      set age=age+1
      where firstname='Dirk' and lastname='Smith';
  3. All secretaries are now called "Administrative Assistant". Update all titles accordingly.

    update myemployees_ts0211
      set title = 'Administrative Assistant'
      where title = 'Secretary';
  4. Everyone that's making under 30000 are to receive a 3500 a year raise.

    update myemployees_ts0211
      set salary = salary + 3500
      where salary < 30000;
  5. Everyone that's making over 33500 are to receive a 4500 a year raise.

    update myemployees_ts0211
      set salary = salary + 4500
      where salary > 33500;
  6. All "Programmer II" titles are now promoted to "Programmer III".

    update myemployees_ts0211
      set title = 'Programmer III'
      where title = 'Programmer II'
  7. All "Programmer" titles are now promoted to "Programmer II".

    update myemployees_ts0211
      set title = 'Programmer II'
      where title = 'Programmer'

Back to Updating records

 

SQL Course Curriculum
123456789 next>>