<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-17424341</id><updated>2011-11-25T19:42:25.723-08:00</updated><title type='text'>ORACLE HW</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>30</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-17424341.post-114869857187343889</id><published>2006-05-26T18:49:00.000-07:00</published><updated>2006-05-26T19:56:12.153-07:00</updated><title type='text'></title><content type='html'>SECTION 7&lt;br /&gt;LESSON 1&lt;br /&gt;1. What DJs on Demand cd titles were produced in any year before "Carpe Diem" was produced?&lt;br /&gt;&lt;br /&gt;----selelct title&lt;br /&gt;       from d_cds&lt;br /&gt;       where year&gt;all(select year from d_cds where title='Carpe Diem');&lt;br /&gt;&lt;br /&gt;2. Write a query that returns jazz and pop songs. Write a multi-row subquery and use the d_songs and d_types tables. Include the id, title, duration, and the artist name.&lt;br /&gt;&lt;br /&gt;----select id,duration,artist&lt;br /&gt;       from d_songs&lt;br /&gt;       where type_code=any(select code from d_types where description in('jazz,'pop'));&lt;br /&gt;&lt;br /&gt;3. Find the DJs on Demand events whose cost was less than or equal to the low-range cost of package code 200?&lt;br /&gt;&lt;br /&gt;----select name&lt;br /&gt;       from d_events&lt;br /&gt;       where cost=&lt;all(select low_range from d_packages where code=200);&lt;br /&gt;&lt;br /&gt;4. Find the last names of all employees whose salaries are the same as the minimum salary for any department.&lt;br /&gt;&lt;br /&gt;----select last_name&lt;br /&gt;       from employees&lt;br /&gt;       where salary=any(select min(salary) from employees group by department_id);&lt;br /&gt;&lt;br /&gt;5. Which Global Fast Foods employee earns the lowest salary? Hint: You can use either a single-row or a multiple-row subquery.&lt;br /&gt;&lt;br /&gt;----select first_name,last_name&lt;br /&gt;       from f_staffs&lt;br /&gt;       where salary=(select min(salary) from f_staffs group by id);&lt;br /&gt;&lt;br /&gt;6. Place the correct multiple-row comparison operators in the outer query WHERE clause of each of the following:&lt;br /&gt;a. Which CDs in our d_cds collection were produced before "Carpe Diem" was produced? WHERE year __&gt;all____ (SELECT year ...&lt;br /&gt;b. Which employees have salaries lower than any one of the programmers in the IT department?WHERE salary___&lt;any__(SELECT salary ...&lt;br /&gt;c. What CD titles were produced in the same year as "Party Music for All Occasions" or "Carpe Diem"?WHERE year ___in_____(SELECT year ...&lt;br /&gt;d. What song title has a duration longer than every type code 77 title?WHERE duration __&gt;any___(SELECT duration ...&lt;br /&gt;&lt;br /&gt;7. Which of the following are True? Each WHERE clause is from the outer query.&lt;br /&gt;_T__a. WHERE size &gt; ANY If the inner query returns sizes ranging from 8 to 12, the value 9 could be returned in the outer query.&lt;br /&gt;_T__b. WHERE book_number IN If the inner query returns books numbered 102, 105, 437, and 225 then 325 could be returned in the outer query.&lt;br /&gt;_F__c. WHERE score &lt;= ALL If the inner query returns the scores 89, 98, 65, and 72, then 82 could be returned in the outer query.&lt;br /&gt;_F__d. WHERE color NOT IN If the inner query returns red, green, blue, black, and then the outer query could return white.&lt;br /&gt;_F__e. WHERE game_date = ANY If the inner query returns 05-JUN-97, 10-DEC-02, and 2-JAN-04, then the outer query could return 10- SEP-02.&lt;br /&gt;&lt;br /&gt;8. The goal of the following query is to display the minimum salary for each department whose minimum salary is less than the lowest salary of the employees in department 50. However, the subquery does not execute because it has five errors. Find them, correct them, and run the query.SELECT department_idFROM employeesWHERE MIN(salary)HAVING IN(salary) &gt;GROUP BY department_idSELECT MIN(salary)WHERE Dpartment_id &lt; 50;&lt;br /&gt;&lt;br /&gt;----select min(salary)&lt;br /&gt;       from employees&lt;br /&gt;       where min(salary)&lt;(select min(salary) from employees where department_id=50);&lt;br /&gt;      &lt;br /&gt;9. Which statements are True about the subquery below?&lt;br /&gt;SELECT employee_id, last_name&lt;br /&gt;FROM employees&lt;br /&gt;WHEREsalary =(SELECT MIN(salary)FROM employeesGROUP BY department_id);&lt;br /&gt;__F___a. The inner query could be eliminated simply by changing the WHERE clause to WHERE MIN(salary).&lt;br /&gt;__T_b. The query wants the names of employees who make the same salary as the smallest salary in any department.&lt;br /&gt;____T_c. The query firsts selects the employee ID and last name, ad then compares that to the salaries in every department.&lt;br /&gt;____F__d. This query will not execute.&lt;br /&gt;&lt;br /&gt;10. Place an X next to those values that could be returned by the outer query if the inner query returned 185.98, 315.75, 382.24, and 877.31 with the following WHERE clause:WHERE total_sales &lt; ANY__*_a. 155.22_____b. 325.88_____c. 877.30_____d. 382.24&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114869857187343889?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114869857187343889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114869857187343889' title='40 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114869857187343889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114869857187343889'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/05/section-7-lesson-1-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>40</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114853407577208565</id><published>2006-05-24T22:14:00.000-07:00</published><updated>2006-05-27T18:32:00.770-07:00</updated><title type='text'></title><content type='html'>&lt;span style="font-family:arial;color:#330099;"&gt;SECTION 6 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;LESSON 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;1. In the SQL query shown below, which of the following is True about this query?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;____T___a. Kimberly Grant would not appear in the results set.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;___F____b. The GROUP BY clause has an error because the manager_id is not listed in the SELECT clause.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;___T____c. Only salaries greater than 16001 will be in the result set.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;___T____d. Names beginning with Ki will appear after names beginning with Ko.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;___F____e. Last names such as King and Kochhar will be returned even if they don't have salaries &gt; 16000.&lt;br /&gt;SELECT last_name, MAX(salary)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;FROM employees&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;WHERE last_name LIKE 'K%'GROUP BY manager_id, last_name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;HAVING MAX(salary) &gt;16000 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;ORDER BY last_name DESC&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;2. Each of the following SQL queries has an error. Find the error and correct it. Use HTML DB to verify that your corrections produce the desired results.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;a. SELECT manager_id &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;FROM employees &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;Having AVG(salary) &lt;1600&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;GROUP BY manager_id;&lt;br /&gt;b. SELECT cd_number, COUNT(title) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;FROM d_cds &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;WHERE cd_number &lt;&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;GROUP BY CD_NUMBER;&lt;br /&gt;c. SELECT ID, MAX(ID), artist AS Artist &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;FROM d_songs &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;WHERE duration IN('3 min', '6 min', '10 min') &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;AND ID &lt;&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;GROUP by ID;&lt;br /&gt;d. SELECT loc_type, rental_fee AS Fee &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;FROM d_venues &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;WHERE id &lt;100&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;GROUP BY rental_fee,loc_type;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;3. Rewrite the following query to accomplish the same result:&lt;br /&gt;SELECT DISTINCT MAX(song_id) FROM d_track_listingsWHERE track IN ( 1, 2, 3);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select max(distinct song_id)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from d_track_listings&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where track in (1,2,3);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;4. Your teacher needs an alphabetized list of all students?first and last names and the class average for Test 1. She would like the results grouped by gender (male and female), but only show male students whose grade level is 10. Write pseudocode for the SQL statement needed to accomplish the task.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select first_name,last_name,avg(grade)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from class&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where grade=10 and gender='male'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;group by gender;&lt;br /&gt;5. Indicate True or False &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;__T___a. If you include a group function and any other individual columns in a SELECT clause, then each individual column must also appear in the GROUP BY clause. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;__F___b. You can use a column alias in the GROUP BY clause.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;__T___c. The GROUP BY clause always includes a group function. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;LESSON 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;Complete the practice exercises.Mark T or F for each of the following questions:&lt;br /&gt;__F___1. The CONCAT character function combines two or more character values into one character string.&lt;br /&gt;__T___2. The SYSDATE function returns the Oracle Server date and time.&lt;br /&gt;__T___3. The RPAD character function returns a right-justified value with a string of characters replicated to fill a specified number of character positions.&lt;br /&gt;__T___4. The ROUND number function will round 469.89 to 470 if the decimal place value is omitted.&lt;br /&gt;__T___5. The SUBSTR character function returns a portion of a string beginning at the start of a string to a specified number of characters.&lt;br /&gt;__T___6. DESC will order alphabetical data from Z to A.&lt;br /&gt;__F___7. The column name in a SELECT statement is an example of a SELECTION.&lt;br /&gt;__T___8. You cannot use a column alias in the WHERE clause.&lt;br /&gt;__F___9. To specify an alias in the SELECT clause for retired employee, use 'Retired Employee.'&lt;br /&gt;__F___10. Aliases always appear in UPPERCASE, unless enclosed within proper quote marks.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;__F___11. If any column value in an arithmetic expression is NULL, the result defaults to 0.&lt;br /&gt;__F___12. Null values are treated as zero when using SUM functions.&lt;br /&gt;__F__13. In arithmetic expressions, multiply and divide are evaluated after addition and substraction.&lt;br /&gt;__F__14. By default, column headings are returned in UPPERCASE.&lt;br /&gt;__T__15. SQL statements are not case-sensitive, unless indicated.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;__T__16. SQL statements can be entered on one or more lines.&lt;br /&gt;__T__17. SQL keywords can be abbreviated using single quotes.&lt;br /&gt;__F__18. Columns are displayed in the order in which they appear in the WHERE clause.&lt;br /&gt;__F__19. Column aliases that are more than one word require the AS prefix.&lt;br /&gt;__F_20. In the SELECT clause, if an expression is not a column name or a column alias, it is a literal value.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;__F__21. Number and date values must be enclosed in single quotes.&lt;br /&gt;__F__22. The keyword DISTINCT will affect all of the columns in the statement: SELECT DISTINCT(employee_id, department_id,department_name)&lt;br /&gt;__T__23. HTML DB is a type of application.&lt;br /&gt;__F__24. VARCHAR2 describes variable-length character values.&lt;br /&gt;__F__25. To restrict the rows returned from a query, use the SELECT clause.&lt;br /&gt;__T__26. The comparison operator IN is used to match any of a list of items.&lt;br /&gt;__T__27. Using WHERE employee_id = NULL returns all employees where do not have an employee ID.&lt;br /&gt;__T__28. BETWEEN 250 AND 350 will return 101 values.&lt;br /&gt;__F__29. LIKE '_ _ e%' could return 'Fred.'&lt;br /&gt;__T_30. To return SA_MAN, use LIKE ' SA /_%' ESCAPE ' \ '&lt;br /&gt;__T_31. Logical operators are evaluated in the AND, OR, NOT order.&lt;br /&gt;__F__32. WHERE e.last_name LIKE 'Sm%' OR d.department_id = 60 AND d.department_name = 'IT' could return anyone from the IT department whose department ID is 60.&lt;br /&gt;__F_33. The rules of precedence would evaluate an expression that contained each of the following in the order: arithmetic, concatenation, NOT, OR&lt;br /&gt;__F__34. The ORDER BY clause comes last in the SELECT statement.&lt;br /&gt;__F__35. In SELECT last_name, first_name, the ORDER BY clause could include department_id.&lt;br /&gt;__F__36. The order of execution of a SELECT statement is: FROM, WHERE, SELECT, ORDER BY&lt;br /&gt;__F__37. ADD_MONTHS(hire_date, 6) will return a number.&lt;br /&gt;__F__38. MONTHS BETWEEN ('05-DEC-89' , '10-JUN-93') will return 4.&lt;br /&gt;__T__39. If April 21st is a MONDAY, then NEXT_DAY('21-APR'-03', 'FRIDAY') will return 25-APR-03.&lt;br /&gt;__F__40. ROUND(SYSDATE, 'YEAR') will return 01-JAN-05 if today is August 23, 2004.&lt;br /&gt;__T__41. All group functions ignore NULL values.&lt;br /&gt;__F__42. SELECT COUNT( last_name, first_name) will return the number of last and first names in the database.&lt;br /&gt;__F__43. If salary values in a column are 5000, null, 4000, 7000, using AVG(salary) will return 4000.&lt;br /&gt;__T__44. AVG(DISTINCT salary) will average only the salaries that are different from each other.&lt;br /&gt;__T__45. NULLIF(salary, 4000) will return 4000 if the employee's salary is 5000.&lt;br /&gt;__T_ 46. COALESCE(hire_date, salary, commission_pct) will return salary if the hire date is NULL.&lt;br /&gt;__T_ 47. The HAVING clause is used to restrict groups.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;__F_48. a GROUP BY clause is used, any column that is in the SELECT clause that is not a group function must be listed in the GROUP BY clause.&lt;br /&gt;__F__49. If a query lists clauses WHERE, GROUP BY, and HAVING, no ORDER BY clause can be used.&lt;br /&gt;__T__50. If a join is needed and you want to use a WHERE clause, choose a JOIN ON or JOIN USING join.&lt;br /&gt;__T__51. COUNT(DISTINCT department_id) will return the number of different department IDs.&lt;br /&gt;__F__52. If a column had 4 NULL employee IDs and 250 defined IDs, COUNT will return 254.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;LESSON 5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;1. You need to know the title and artist of all DJs on Demand songs that have the same type code as the song, "I'm Going to Miss My Teacher."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select title,artist&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from d_songs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where type_code=(select type_code from d_songs where title='I'm Going to Miss My Teacher');&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;2. What Oracle employees have a salary greater than the maximum salary of any ST_CLERK?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select job_title &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from jobs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where salary&gt;(select max_sslary from jobs where job_title='ST_CLERK');&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;3. What DJs on Demand d_play_list_items song_id's have the same event_id as song_id 45?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select event_id&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from d_play_list_items&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where event_id=(select event_id from d_play_list_items where song_id=45);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;4.Which events in the DJs on Demand database cost more than event_id = 100?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from d_events&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where cost&gt;(select cost from d_events where event_id=100);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;5. Find the track number of the song that has the same CD number as "Party Music for All Occasions."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select cd_number&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from d_track_listings&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where song_id=(select id from d_songs where title='Party Music for All Occasions');&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;6. List the DJs on Demand events whose theme code is the same as the code for "Tropical."&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;br /&gt;----select name&lt;br /&gt;from d_event&lt;br /&gt;where theme_code=(select code from d_themes where description='Tropical');&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;7. What are the names of the Global Fast Foods staff members whose salary is greater than the staff member whose ID is 12?&lt;/span&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;br /&gt;----select last_name,first_name&lt;br /&gt;from f_staffs&lt;br /&gt;where salary&gt;(select salary from f_staffs where id=12);&lt;br /&gt;&lt;br /&gt;8. What are the names of the Global Fast Foods staff members whose staff type is not the same as Bob Miller's?&lt;br /&gt;&lt;br /&gt;----select last_name,first_name&lt;br /&gt;from f_staffs&lt;br /&gt;where staff_type!=(select staff_type from f_staffs where last_name='Miller' and first_name='Bob');&lt;br /&gt;&lt;br /&gt;9. What is the staff type for those Global Fast Foods jobs that have a salary less than those of any Cook staff-type jobs?&lt;br /&gt;&lt;br /&gt;----select staff_type&lt;br /&gt;from f_staffs&lt;br /&gt;where salary&lt;(select salary from f_staffs where staff_type='Cook'); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;10. What DJs on Demand events have the same theme code event ID = 100? &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;---- select name &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from d_events &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where theme_code=(select theme_code from d_evnets where id=100); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;11. Which Oracle employees have the same department ID as the IT department?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select last_name,first_name &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from employees &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where department_id=(select department_id from departments where department_name='IT'); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;12. What are the department names of the Oracle departments that have the same location ID as Seattle? &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select department_id &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from departments &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where location_id=(select location_id from locations where city='Seattle'); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;13. Return the department ID and minimum salary of all employees, grouped by department ID, having a minimum salary greater than the minimum salary of those employees whose department ID is not equal to 50.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;----select department_id, min(salary) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;from employees where min(salary)&gt;(select min(salary) from employees &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;&lt;span style="font-family:arial;color:#330099;"&gt;where department_id!=50)&lt;br /&gt;group by department_id;&lt;br /&gt;&lt;br /&gt;14. Which statement(s) regarding subqueries is/are true?&lt;br /&gt;a. It is good programming practice to place a subquery on the right side of the comparison operator.&lt;br /&gt;b. A subquery can reference a table that is not included in the outer query's FROM clause.&lt;br /&gt;c. Single-row subqueries can return multiple values to the outer query.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;----a &lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114853407577208565?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114853407577208565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114853407577208565' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114853407577208565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114853407577208565'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/05/section-6-lesson-1-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114852921359293309</id><published>2006-05-24T20:53:00.000-07:00</published><updated>2006-05-24T20:53:33.933-07:00</updated><title type='text'></title><content type='html'>&lt;span style="font-family:arial;color:#996633;"&gt;SECTION 5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;LESSON 1&lt;br /&gt;Refer to the review examples shown below to answer the following questions about joins:&lt;br /&gt;1. How do you know where to place the (+) in an outer join?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----the other side has null information&lt;br /&gt;2. How do you know whether to indicate a join as a right, left, or full outer join?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----what side or both sides have null information&lt;br /&gt;3. What is the function of the WHERE clause in an equijoin?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----provide the conditions to join tables&lt;br /&gt;4. When using a nonequijoin, what conditions must be true about the data in each table?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----the column name&lt;br /&gt;5. What data will not be returned in a natural join between two tables?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----not match&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;LESSON 4&lt;br /&gt;1. Create a query that will show the average cost of the DJ on Demand events. Round to two decimal places.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select round(avg(cost),2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from d_events;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;2. Find the average salary for Global Fast Foods staff members whose manager ID is 19.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select avg(salary)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from f_staffs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;where manager_id=19;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;3. Find the sum of the salaries for Global Fast Foods staff members whose IDs are 12 and 9.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;---select sum(salary)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from f_staffs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;where id in(12,19);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;4. Using the Oracle database, select the lowest salary, the most recent hire date, the last name of the person who is at the top of an alphabetical list of employees, and the last name of the person who is at the bottom of an alphabetical list of employees. Select only employees who are in departments 50 or 60.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select min(salary),max(hire_date),min(last_name),max(last_name)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from employees&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;where department_id in(50,60);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;5. Your new Internet business has had a good year financially. You have had 1,289 orders this year. Your customer order table has a column named total_sales. If you submit the following query, how many rows will be returned?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;SELECT sum(total_sales)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;FROM orders;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----none&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;6. You were asked to create a report of the average salaries for all employees in each division of the company. Some employees in your company are paid hourly instead of by salary. When you ran the report, it seemed as though the averages were not what you expected. They were much higher than you thought! What could have been the cause?&lt;br /&gt;&lt;br /&gt;----someone paid hourly, someone paid yearly&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;7. Employees of Global Fast Foods have birth dates of July 1, 1980, March 19, 1979, and March 30, 1969. If you select MIN(birthdate), which date will be returned? &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----March 10,1969&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;8. Create a query that will return the average order total for all Global Fast Foods orders from January 1, 2002, to December 21, 2002.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select avg(order_total)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from d_orders&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;where order_date is between 'January 1, 2002' and 'December 21, 2002';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;9. What was the hire date of the last Oracle employee hired?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select max(hire_date)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from employees;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;10. In the following SELECT clause, which value returned by the SELECT statement will be larger?SELECT SUM(operating_cost), AVG(operating_cost)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----SUM(operating_cost)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;LESSON 5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;1. How many songs are listed in the DJs on Demand D_SONGS table?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select count(id)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from d_songs;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;2. In how many different location types has DJs on Demand had venues?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select count(distinct loc_type)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from d_venues;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;3. The d_track_listings table in the DJs on Demand database has a song_id column and a cd_number column. How many song IDs are in the table and how many different CD numbers are in the table?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select count(song_id),count(distinct cd_number)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from D_TRACK_LISTINGs;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;4. How many of the DJs on Demand customers have email addresses? &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select count(email)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from d_clients;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;5. Some of the partners in DJs on Demand do not have authorized expense amounts (auth_expense_amt). How many partners do have this privilege?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select count(auth_expense_amt)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from partners;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;6. Using the table shown, what values will be returned when the following statement is issued?&lt;br /&gt;SELECT COUNT(shoe_color), COUNT(DISTINCT shoe_color)FROM shoes;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----the total number of shoes, the number of shoes for different types&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;7. Create a query that will convert any null values in the auth_expense_amt column on the DJs on Demand D_PARTNERS table to 100000 and find the average of the values in this column. Round the result to two decimal places.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;----select round(avg(nvl(auth_expense_amt,100000)),2) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#996633;"&gt;from d_partners;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114852921359293309?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114852921359293309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114852921359293309' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114852921359293309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114852921359293309'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/05/section-5-lesson-1-refer-to-review.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114523479302981688</id><published>2006-04-16T17:24:00.000-07:00</published><updated>2006-05-24T18:58:28.413-07:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION4 LESSON 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;Use the Oracle database for problems 1 - 4.&lt;br /&gt;1. Create a cross-join that displays the last name and department name from the employees and departments tables.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;----select employees.last_name,departments.department_name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;from employees cross join departments;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;2. Create a query that uses a natural join to join the departments table and the locations table by the location_id column. Display the department id and name, location id, and city.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;----select departments.department_id,location_id,locations.city&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;from departments natural join locations;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;3. Rewrite problem 2 using equijoin syntax.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;----select d.department_id,d.location_id,l.city&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;from departments d,locations l&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;where d.location_id=l.location_id;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;4. Create a query that uses a natural join to join the departments table by the location_id column. Restrict the output to only department IDs of 20 and 50. Display the department id and name, location id, and city.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;----select departments.department_id,departments.department_name,location_id, locations.city&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;from departments natural join locations&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;where departments.department_id = 20&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;or departmnets.department_id=50;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;5. Use an equijoin between the DJs on Demand database tables, d_songs and d_types. Display the type code, description and title. Limit the rows returned to those type codes between 70 and 80.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;---- select d_songs.type_code,d_songs.title,d_types.description&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;from d_songs,d_types&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;where d_songs.type_code=d_types.code&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;and d_songs.type_code is between 70 and 80;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;6. a. When using Oracle proprietary syntax, the join condition is always placed in the _____where__________ clause of the SELECT statement.&lt;br /&gt;b. When using ANSI/ISO SQL: 1999 syntax, the join condition is always placed in the _____from__________ clause of the SELECT statement.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;7. A/an ______equijoin_________ can be used to preface the column name in order to clarify which table and column are participating in the join.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;8. Table aliases are created in the ________from________ clause of the SELECT statement. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;LESSON 3&lt;/span&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;br /&gt;1. Join the Oracle database locations and departments table using the location_id column. Limit the results to location 1400 only.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;----select * &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;from locations l join departments d &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;on(l.location_id=d.location_id);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;br /&gt;2. Join DJ on Demand d_play_list_items, d_track_listings, and d_cds tables with the JOIN USING syntax. Include the song ID, CD number, title, and comments in the output.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;br /&gt;----select dd.title,dd.cd_number,dd.song_id,dp.comments&lt;br /&gt;from d_cd dd join d_track_listing dt join d_play_list_items dp&lt;br /&gt;on(dd.cd_number=dt.cd_number, and dt.song_id=dp.song_id);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;3. Display the city, department name, location ID, and department ID for departments 10, 20, and 30 for the city of Seattle. &lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;----select city,department_name,location_id,department_id&lt;br /&gt;from departments join locations&lt;br /&gt;using (location_id)&lt;br /&gt;where department_id in (10,20,30)&lt;br /&gt;and city='Seattle';&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;color:#9999ff;"&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="color:#9999ff;"&gt;4. Display country name, region ID and region name for Americas.&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="color:#9999ff;"&gt;----select country_name,region_id,region_name &lt;/span&gt;&lt;span style="color:#9999ff;"&gt;from countries join regionsusing(region_id)&lt;/span&gt;&lt;span style="color:#9999ff;"&gt;where country_name='United States of America';&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;5. write a statement joining the employees and jobs tables. Display the first and last names, hire date, job id, job title and maximum salary. Limit the query to those employees who are in jobs that can earn more than $12,000. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;----select first_name,last_name,hire_date,job_id,job_title,max_salary &lt;/span&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;from employees join jobs &lt;/span&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;using (job_id) &lt;/span&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;where salary&gt;=12000;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:arial;color:#9999ff;"&gt;&lt;p&gt;6. Display job title, employee first name, last name, and email for all employees that are stock clerks. &lt;/p&gt;&lt;p&gt;----select first_name,last_name,email,job_title from jobs join employees using (job_id) where job_title='Stock Clerk';&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The following questions use the JOIN…ON syntax:&lt;br /&gt;7. Write a statement that displays the employee ID, first name, last name, manager ID, manager first name, and manager last name for every employee in the employees table. Hint: this is a self-join. &lt;/p&gt;&lt;p&gt;----select e.employee_id,e.first_name,e.last_name,m.employee_id,m.first_name,m.last_name from employees e,employees m where e.employee_id=m.employee_id;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;8. Use JOIN ON syntax to query and display the location ID, city and department name for all Canadian locations. &lt;/p&gt;&lt;p&gt;----select location_id,city,department_name from departments d join locations l on(d.location_id=l.location_id) where country_id='CA'&lt;/p&gt;&lt;p&gt;&lt;br /&gt;9. Query and display manager ID, department ID, department name, first name, and last name for all employees in departments 80, 90, 110, and 190. &lt;/p&gt;&lt;p&gt;----select manager_id,department_id,department_name,first_name,last_name from employees join departments using(department_id) where department_id in(80,90,110,190)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;10. Display employee ID, last name, department ID, department name, and hire date for those employees whose hire date was June 7, 1994. &lt;/p&gt;&lt;p&gt;----select employee_id,last_name,department_id,department_name,hire_date from employees join departments using(department_id) where hire_date='June 7,1994';&lt;/p&gt;&lt;p&gt;LESSON 4&lt;br /&gt;1. Return the job ID, job title, first name, last name, and department ID of all employees with a job ID of IT_PROG.&lt;br /&gt;&lt;br /&gt;----select job_id, job_title,first_name,last_name,department_id&lt;br /&gt;       from employees join jobsusing (job_id)&lt;br /&gt;       where job_id='IT_PROG';&lt;br /&gt;2. Display the employee's last name and employee number along with the manager's last name and manager number. Label the columns Employee, Emp#, Manager, and Mgr#, respectively.&lt;br /&gt;&lt;br /&gt;----select e.last_name "Employee",e.employee_id "Emp#",m.last_name "Mnager",m.employee_id "Mgr#"&lt;br /&gt;      from employees e,employees m&lt;br /&gt;      where e.employee_id=m.employee_id;&lt;br /&gt;3. Modify problem 2 to display all employees, including those who have no manager. Order the results by the employee number.&lt;br /&gt;&lt;br /&gt;----select e.last_name "Employee",e.employee_id "Emp#",m.last_name "Mnager",m.employee_id "Mgr#"       from employees e,employees m       where e.employee_id=m.employee_id(+)&lt;br /&gt;       order by e.employee_id;&lt;br /&gt;&lt;br /&gt;4. Create a query of the DJ on Demand database to return the first name, last name, event date, and description of the event the client held. Include all the clients even if they have not had an event scheduled.&lt;br /&gt;&lt;br /&gt;----select first_name,last_name,event_date,description&lt;br /&gt;       from d_clients left outer join d_events&lt;br /&gt;       on(d_clients.client_id=d_events.client_id);&lt;br /&gt;5. Using the Global Fast Foods database, show the shift description and shift assignment date even if there is no date assigned for each shift description.&lt;br /&gt;&lt;br /&gt;----select s.description,sa.shift_assgn_date&lt;br /&gt;       from f_shifts s&lt;br /&gt;       left outer join f_shift_assignments sa&lt;br /&gt;       where s.code=sa.code;&lt;br /&gt;LESSON 5&lt;br /&gt;Practice exercises:1. A/An ______join query__________ is when the rows of the tables are combined with each other and produce new rows . The number of rows is equivalent to the product of the number of rows in each table.&lt;br /&gt;2. A/An _____self join____________ is used when you need to query a table that has a relationship to itself.3. A/An _____cross join____________ preserves unmatched rows from one or both tables, returning the rows that are matched and unmatched from one or both tables.4. In an outer join, a plus sign (+) is placed on the side of the join that is _____null____________ information.5. A ______outer____________is used when a column in one table does not correspond directly to a column in another table.6. The join condition is always placed in the ____on___________ clause of the SELECT statement.7. A/An _____aliases__________ is used to preface the column name in order to clarify which table and column are participating in the join.8. Table aliases are created in the ____from____________ clause of the SELECT statement.9. In a full outer join, a row that does not contain data will appear in the results set if the row satisfies the join condition.10. Table aliases cannot exceed ___3______ characters in length.11. Identify the Oracle syntax to signify an outer join___________.12. If a join condition is written: WHERE e.client_number = c.client_number, what kind of join would it be if we wanted all the information in the e table even if the c table has missing data? _cross join_____13. Joins that are based on hierarchical relationships such as manager and employee are called _self join_________.14. How many join conditions does it take to join three tables? _2__15. What does the term "proprietary syntax" mean?16. What type of join condition is best when two columns with the same name but different data types exist in two different tables?&lt;br /&gt;cross join17. What type of join(s) are based on all columns in two tables that have the same name?&lt;br /&gt;self join18. Another name for a cross-join is a___nonequijoin________.19. When specifying a join, you need to identify the what, where, and how. Match up these terms to the SQL syntax words: FROM, WHERE, SELECT.20. For each join condition listed, mark T for those that can include an alias in the syntax:___ cross-join___ equijoin___ nonequijoin___ natural join___ full outer join___ left outer join___ USING clause21. Which two types of join conditions cannot use an alias?&lt;br /&gt;natural join22. The query below is an example of what kind of join?SELECT last_name, first_nameFROM f_staffs, f_orders;&lt;br /&gt;cross join23. Use the three tables shown to answer the following questions:a. What kind of join would you use to join all three tables? ______equrium____________ Write the syntax that would produce the desired result.b. Name two tables that could be used to retrieve data from a natural join.Write the syntax that would produce the desired result.c. What kind of join would you use to return only those students who have mentors?Write the syntax that would produce the desired result.d. What kind of join would you use to return all students whether they have a mentor or not.Write the syntax that would produce the desired result.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114523479302981688?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114523479302981688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114523479302981688' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114523479302981688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114523479302981688'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/04/section4-lesson-2-use-oracle-database.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114523311709338043</id><published>2006-04-16T16:31:00.000-07:00</published><updated>2006-04-16T17:19:32.143-07:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 3 LESSON 5&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;1. Display the employee's last name and employee number along with the manager's last name and manager number. Label the columns:Employee, Emp#, Manager, and Mgr#, respectively. -&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;---select e.last_name "Employee",e.employee_id "Emp #",m.manager_id "Mgr #",m.last_name "Manager" &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;from employees e,employees m &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;where e.employee_id=m.manager_id &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;2. Modify question 1 to display all employees and their managers, even if the employee does not have a manager. Order the list alphabetically by the last name of the employee.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;----select e.last_name "Employee",e.employee_id "Emp #",m.manager_id "Mgr #",m.last_name "Manager"&lt;br /&gt;from employees e,employees&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;where e.employee_id(+)=m.manager_id&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;order by e.last_name;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;3. Display the names and hire dates for all employees who were hired before their managers, along with their managers' names and hire dates. Label the columns Employee, Emp Hired, Manager, and Mgr Hired, respectively&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;d&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;---- select e.first_name' 'e.last_name "Employee",e.hire_date "Emp Hire",m.first_name' 'm.last_name "Manager",m.hire_date "Mgr Hire"&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;from employees e,employees m&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;where e.manager_id=m.employee_id and e.hire_date&lt;m.hire_date;&lt;m.hire_date&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;span style="color:#ff9966;"&gt;4. Finish this code to produce all possible combinations of rows from both tables:&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;SELECT e.last_name, e.department_id, d.department_name &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;----SELECT e.last_name, e.department_id, d.department_name &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;from employees e,departments d&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;where e.department_id=d.department_id;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;5. Finish this code to produce all information in the departments table whether it has a match in the locations table or not:&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;SELECT l.location_id, l.city, d.department_name &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;----SELECT l.location_id, l.city, d.department_name &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;from locations l,departments d&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;where l.location_id=d.department_id;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;6. Finish this code to produce the following information for Diana Lorentz:&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;SELECT e.last_name, d.department_name &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;----select e.last_name,d.department_name&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;from employees e,departments d&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;where e.last_name='Diana', e.first_name='Lorentz'&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;and e.department_id=d.department_id;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;7. How do you know which side of a join gets the (+) sign? &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff9966;"&gt;----This side has the values that the other doesn't.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#ff9966;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114523311709338043?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114523311709338043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114523311709338043' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114523311709338043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114523311709338043'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/04/section-3-lesson-5-1_16.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114512134888317157</id><published>2006-04-15T09:35:00.000-07:00</published><updated>2006-04-15T10:15:48.953-07:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 3 LESSON 4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;1. You need to produce a report for Global Fast Foods showing customers and orders. A customer must be included on the report even if the customer has had no orders. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;----select *&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;       from f_customers,f_orders&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;       where f_customers.id=f_orders.cust_id(+);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;2. Create a query of the Oracle database that shows employee last names, department IDs, and department names. Include all employees even if they are not assigned to a department.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;----select d.department_name,e.last_name,e.department_id&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;       from departments d,employees e&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;       where e.department_id=d.department_id(+);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;3. Modify the query in problem 2 to return all the department IDs even if no employees are assigned to them.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;----select d.department_name,e.last_name,e.department_id&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;       from departments d,employees e&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;       where e.department_id(+)=d.department_id;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt; 4. There are one or more errors in each of the following statements. Describe the errors and correct them.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;a. WHERE e.department_id(+) = d.department_id (+);&lt;br /&gt;b. SELECT e.first_name,e.last_name, d.department_name, e.department_id&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;    FROM employees e, departments d&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;    WHERE e.department_id = d.department_id;&lt;br /&gt;c. WHERE e.position &gt;= p.highest and&lt;=p.lowest;&lt;br /&gt;d. SELECT e.employee_id, e. last_name, d. location_id&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;     FROM employees e, departments d&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;     WHERE e.department_id = d.department_id;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;5. Create a query that will show all CD titles and song IDs in the DJ on Demand database even if there is no CD number in the track-listings table.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;----select dc.cd_number,dc.title,dt.cd_number&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;       from d_cds dc,d_track_listings dt&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#663333;"&gt;       where dc.cd_number(+)=dt.cd_number;&lt;br /&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114512134888317157?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114512134888317157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114512134888317157' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114512134888317157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114512134888317157'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/04/section-3-lesson-4-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114472234679449112</id><published>2006-04-10T17:36:00.000-07:00</published><updated>2006-04-10T19:25:47.066-07:00</updated><title type='text'></title><content type='html'>&lt;span style="font-family:arial;color:#ff6666;"&gt;SECTION 3 LESSON 3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;1. Create a join based on the cost of the event between the DJs on Demand tables D_EVENTS and D_PACKAGES. Show the name of the event and the code for each event.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;---- select de.name,dp.code&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;        from d_events de, d_packages dp&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;        where de.cost between dp.low_range and dp.high_range;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;2. Using the Oracle database, create a query that returns the employee last name, salary, and job-grade level based on the salary. Select the salary between the lowest and highest salaries.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;----select e.last_name,e.salary, jg.grade_level&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;       from employees e, job_grades jg&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;       where salary between lowest_sal and highest_sal&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;3. What condition requires creation of a nonequijoin?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;---- Since there is no exact match between the two columns in each table.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;4. Rewrite the following nonequijoin statement using the logical condition operators (AND, OR, NOT): &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;WHERE a.ranking BETWEEN g.lowest_rank AND g.highest_rank &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;----ranking &gt;= g.lowest_rank and &lt;= g.highest_rank&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;5. How do you know when to use a table alias and when not to use a table alias?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;----the column is so long, and the column has to be used many times&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt; 6. What is the purpose of the WHERE clause in a join?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;----provide the condition&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;7. What kind of join would you use if you wanted to find data between a range of numbers?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;----nonequijoin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;8. What kind of join would you use if you wanted to join two tables on any rows that have the same name and the same data type.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#6666cc;"&gt;----equijoin&lt;br /&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114472234679449112?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114472234679449112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114472234679449112' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114472234679449112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114472234679449112'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/04/section-3-lesson-3-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114335698178816168</id><published>2006-03-25T22:45:00.000-08:00</published><updated>2006-03-25T23:10:51.096-08:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 3 LESSON 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#663333;"&gt;&lt;span style="font-family:arial;"&gt;1. Create a join based on the cost of the event between the DJs on Demand tables D_EVENTS and D_PACKAGES. Show the name of the event and the code for each event. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----select d_packages.code,d_events.name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from d_packages, d_events&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;where d_events.cost between d_packages.low_range and d_packages.high_range;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;2. Using the Oracle database, create a query that returns the employee last name, salary, and job-grade level based on the salary. Select the salary between the lowest and highest salaries.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----select e.last_name,e.salary,j.grade_level&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from employees e,job_grades j&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#663333;"&gt;&lt;span style="font-family:arial;"&gt;where e.salary between j.lowest_sal and highest_sal;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;3. What condition requires creation of a nonequijoin?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----There is no exact match between the two columns in each table.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#663333;"&gt;&lt;span style="font-family:arial;"&gt;4. Rewrite the following nonequijoin statement using the logical condition operators (AND, OR, NOT): WHERE a.ranking BETWEEN g.lowest_rank AND g.highest_rank&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#663333;"&gt;&lt;span style="font-family:arial;"&gt;5. How do you know when to use a table alias and when not to use a table alias?&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----Working with lengthy column and table names can be cumbersome. Fortunately, there is a way to shorten the syntax using aliases. To distinguish columns that have identical names but reside in different tables, use column aliases. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;6. What is the purpose of the WHERE clause in a join?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----Don't need to list all information of the tables, only the information that will be used.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;7. What kind of join would you use if you wanted to find data between a range of numbers?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----nonequijoin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#663333;"&gt;&lt;span style="font-family:arial;"&gt;8. What kind of join would you use if you wanted to join two tables on any rows that have the same name and the same data type.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----equijoin&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114335698178816168?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114335698178816168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114335698178816168' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114335698178816168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114335698178816168'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/03/section-3-lesson-2-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114335545499166365</id><published>2006-03-25T21:07:00.000-08:00</published><updated>2006-03-25T22:44:15.046-08:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 3 LESSON 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;1. Create a Cartesian product that displays the columns in the d_play_list_items and the d_track_listings in the DJs on Demand database. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;----select *&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;       from d_play_list_items,d_track_listings&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;2. Correct the Cartesian product produced in question 1 by creating an equijoin using a common column.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;----select d_play_list_items.song_id,d_track_listings.song_id&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;       from d_play_list_items,d_track_listings&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;       where d_play_list_items.song_id=d_track_listings.song_id;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;3. Write a query to display the title, type description, and artist from the DJs on Demand database.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;----select d_songs.title,d_songs.artist,d_types.description&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;       from d_songs,d_types;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;4. Rewrite the query in question 3 to select only those titles with an ID of 47 or 48.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;----select id,d_songs.title,d_songs.artist,d_types.description&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;       from d_songs,d_types&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;       where d_songs.id in(47,48);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;5. Write a query that extracts information from three tables in the DJs on Demand database, the d_clients table, the d_events table, and the d_job_assignments table. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;----select *&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;       from d_clients table,d_events table,the d_job_assignments;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;6. Create and execute an equijoin between DJs on Demand tables d_track_listings and d_cds. Return the song_id and the title only.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;----select d_track_listings.song_id,d_cds.title&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;       from d_track_listings,d_cds&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;       where d_track_listings.cd_number=d_cds.cd_number;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;7. Mark T for the statements that are True and F for the statements that are False.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;__f__a. A join is a type of query that gets data from more than one table based on columns with the same name.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;__t__b. To join tables using an equijoin, there must be a common column in both tables and that column is usually a primary key in one of the tables.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;__t__c. A Cartesian product occurs because the query does not specify a WHERE clause.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;__f__d. Table aliases are required to create a join condition.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;__t__e. If a table alias is used for a table name in the FROM clause, it must be substituted for the table name throughout the SELECT statement.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;__f__f. Table alias must be only one character in length.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;__f__g. A simple join or inner join is the same as an equijoin.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;8. What advantage does being able to combine data from multiple tables have for a business?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#66cccc;"&gt;----That is convenient to get information from different tables.&lt;br /&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114335545499166365?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114335545499166365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114335545499166365' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114335545499166365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114335545499166365'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/03/section-3-lesson-1-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114334947762655149</id><published>2006-03-25T20:18:00.000-08:00</published><updated>2006-03-25T21:04:37.666-08:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 2 LESSON 5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;2. Create two different queries that produce the cd number and title as "94CARPE DIEM." Use the d_cds table in the DJ on Demand database.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;----select cd_number//''//upper(title)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       from d_cds;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       select concat(cd_number,upper(title))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       from d_cds;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;3. Mark the following statements as True or False.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__f__a. LOWER converts numbers to lowercase.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__f__b. Use RPAD to move numbers to the right to place an * on the left.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__f__c.. TRIM can be used to trim one or more characters from a string.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__t__d. LENGTH returns a number.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__f__e. SUBSTR is used to substitute one string for another.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__t__f. CONCAT is limited to using two parameters.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__t__g. TRUNC will return zero decimal places if a decimal value is omitted.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;4. Create a query to show the cost of events for DJ on Demand in the format $0000.00&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;----select to_char(cost,'$99999.99')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       from d_events;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;5. For the f_staffs table in the Global Fast Foods database, change the ID of those staff members whose IDs are only single digits to two digits by adding an asterisk * to the front of the number. For example, change ID 9 to ID *9.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;----select last_name,first_name,lpad(id,2,'*')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       from f_staffswhere length(id)=1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt; 6. As the database administrator, you have been asked to store historical employee records in the current database. The records have termination dates from 1990 to 1999. Write a query using DUAL to show how you could store 15-DEC-95.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;----insert into dual&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       value('15-dec-95');&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;7. Using DUAL, format 19-JUN-04 to appear as: 19th of june two thousand four&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;----select to_char('19-JUN-04','DD')' of 'to_char('19-JUN-04','month year')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;8. Create a query that will return only the last word from "Oracle Academy."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;----select substr('Oracle Academy.',8,7)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       from dual;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;9. Lance and Arnie created the following SQL query but it did not return any results. What is the problem with this query?&lt;br /&gt;----SELECT loc_type&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       FROM d_venues&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;       WHERE  ID = 200;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;10. What type of function would you use in each case?D = Date function,N = Number function,C = Conversion/Character functions,G = General function,CE = Conditional expression&lt;br /&gt;__n__a. To convert varchar2 to number data&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__c__b. To format a date to other than the default format&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__c__c. To convert a date such as June 19, 2000 to default format&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__n__d. To format a number to appear as currency&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__g__e. To substitute a value in a table for null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__ce_f. To do an IF-THEN-ELSE statement&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__g__g. To find the first not null expression among a list of expressions&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__c__h. To replace a section of a string with another string&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__d__i. To format a 20th-century date &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;__c__j. To present output all in uppercase&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;_____k. To find the numeric position of a character in a string&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#999999;"&gt;_____l. To find the last day of the month&lt;br /&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114334947762655149?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114334947762655149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114334947762655149' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114334947762655149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114334947762655149'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/03/section-2-lesson-5-2.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114333252309755302</id><published>2006-03-25T16:16:00.000-08:00</published><updated>2006-03-25T20:17:52.456-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;span style="color:#ff6666;"&gt;SECTION 2 LESSON 4&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;color:#003333;"&gt;1. The business manager of Global Fast Foods needs to update the customer list. She wants to find any zip/postal code that has fewer than 10 digits in order to identify those codes without the new format postfix 87392-8723. Create a query to identify those customers.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----select last_name//' '//first_name,zip&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;from f_customers&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;where length(zip)&lt;10;&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;a. LPAD(c) b. ROUND (n,d) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;c. TRUNC(n,d) d. LENGTH(c)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;e. LAST_DAY (d) f. INSTR(c) g. CONCAT (c)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;3. You need to display the auth_expense_amt for each DJ on Demand partner. For those partners who do not have an expense account, the output should display "Not Approved."&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----select last_name//' '//first_name,nvl(to_char(auth_expense_amt),'Not approved.')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;from d_partners;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;4. Jason and Jamie tried to run a report displaying the Global Fast Foods staff members who do not have an overtime rate. They wrote the following SQL query and received a report error: ORA-01722: invalid number.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;SELECT first_name, last_name, NVL(overtime_rate, 'no overtime') As "Payrate"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;FROM f_staffs;&lt;br /&gt;What is wrong with their query and how can it be fixed? &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----SELECT first_name, last_name, NVL(to_char(overtime_rate), 'no overtime') As "Payrate"&lt;br /&gt;FROM f_staffs;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;5. The president of Global Fast Foods likes to send a birthday card to all employees. He has asked you to send a reminder to him on the month of the employee's birthday so the card can be sent with that month's paycheck. Prepare a query to produce the table shown. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----select last_name//' '//first_name,trunc(birthdate,'month')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;from f_staffs;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;6. For each statement, mark T if the statement is True or F if the statement is False.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;a. TO_CHAR is required to convert the date '03-JUN-04' to June 3, 2004.(f)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;b. TO_NUMBER will convert '23-NOV-02' to use with ADD_MONTHS.(f)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;c. TO_DATE will convert SYSDATE to today's date.(f)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;d. TO_NUMBER('101', '$99999') will convert 101 to a number.(f)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;e. TO_CHAR(salary, '$9999.99') will convert number to character format.(t)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;f. TO_NUM(varchar2 column) will convert character data to a number.(t)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;g. TO_CHAR(SYSDATE, 'Month fmdd, yyyy') will format the date. (f)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;7. Employees in the Oracle database who have worked more than 10 years will be given one extra week of vacation. Create a report showing first name, last name, and years worked. Round the result to one decimal place.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----select last_name,first_name,round(months_between(sysdate,hire_date)/12,0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;from employees&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;where months_between(sysdate,hire_date)/12 &gt; 10;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;8. The manager of DJ on Demand needs you to change the zip code for the ID 105, New York venues. She wants to show the old zip code in one column and the new zip code in another column. The new zip code is the same as the old zip code except -2345 needs to be added to the end. The output should appear as shown in the table. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----select id,zip,concat(to_char(zip),'-2345')"new zip"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;from dualwhere id=105;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;9. Create a query using one SELECT statement that returns today's date. Assign an alias to each column.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;a. rounded to the nearest year&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;b. rounded to the nearest month&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;c. truncated to the nearest year&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;d. truncated to the nearest month &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----select round(sysdate,'year') from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;select round(sysdate,'month') from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;select trunc(sysdate,'year') from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;select trunc(sysdate,'month') from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;10. You need to find out how many days it has been since the start of the Global Fast Foods promotional menus. Round the result to the nearest day.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----select round(months_between(sysdate,start_date)*30.5,0)"nearest day"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;from f_promotional_menus;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;11. The Human Resources department (Oracle database) has decided that, for their purposes, the job title for all employees will be the first five letters of the job title followed by an asterisk. For example, the accounting manager will be changed to accou* Create a query to accomplish this request.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----select rpad(substr(job_title,1,5),6,'*')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;from jobs;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;12. What is the order of operations in question 11?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#003333;"&gt;----pregdigest&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114333252309755302?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114333252309755302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114333252309755302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114333252309755302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114333252309755302'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/03/section-2-lesson-4-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114330802947884513</id><published>2006-03-25T08:55:00.000-08:00</published><updated>2006-03-25T16:16:31.436-08:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 2 LESSON 3&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#cc66cc;"&gt;1. For each Global Fast Foods promotional menu, display the event name, and calculate the number of months between today and the ending date of the promotion. Round the months to a whole number. Label the column "Past Promos."&lt;br /&gt;&lt;br /&gt;----select event_name,round(months_between(sysdate,end_date),0)"past promos"&lt;br /&gt;from c_event;&lt;br /&gt;&lt;br /&gt;2. Use the Oracle database to write a query that returns the salary for employee 174 as:Ellen Abel earns $11000.00 monthly but wants $14000.00&lt;br /&gt;&lt;br /&gt;----select last_name' 'first_name' earns'to_char(salary,'$9999999999.99')' monthly but wants $14000.00'&lt;br /&gt;from employees&lt;br /&gt;where employee_id=174;&lt;br /&gt;&lt;br /&gt;3. From the DJ on Demand d_songs table, create a query that replaces the 2-minute songs with "shortest" and the 10-minute songs with "longest." Label the output column "Play Times."&lt;br /&gt;&lt;br /&gt;----select case duration when '2 min' then 'shortest' when '10 min' then 'longest' else duration end"new time"&lt;br /&gt;from d_songs;&lt;br /&gt;&lt;br /&gt;4. Use the Oracle database employees table and CASE expression to decode the department id. Display the department id, last name, salary and a column called "New Salary" whose value is based on the following conditions:&lt;br /&gt;If the department id is 10 then 1.25 * salary&lt;br /&gt;If the department id is 90 then 1.5 * salary&lt;br /&gt;If the department id is 130 then 1.75 * salary&lt;br /&gt;Otherwise, display the old salary.&lt;br /&gt;&lt;br /&gt;----select department_id,salary,case department_id when 10 then 1.25*salary when 90 then 1.5*salary when 130 then 1.75*salary else salary end "new salary"&lt;br /&gt;from employees;&lt;br /&gt;&lt;br /&gt;5. Display the first name, last name, manager ID, and commission percentage of all employees in departments 80 and 90. Display the manager ID in an additional column called "Review." If they don't have a manager, display the commission percentage. If they don't have a commission, display 99999.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#cc66cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#cc66cc;"&gt;----select first_name,last_name,commission_pct,nvl2(manager_id,9999,commission_pct)"review"&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#cc66cc;"&gt;       from employees &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#cc66cc;"&gt;       where department_id in (80,90);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#cc66cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#cc66cc;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114330802947884513?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114330802947884513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114330802947884513' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114330802947884513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114330802947884513'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/03/section-2-lesson-3-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114153659912731735</id><published>2006-03-04T20:05:00.000-08:00</published><updated>2006-03-25T08:30:04.590-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-family:arial;color:#ff6666;"&gt;SECTION 2 LESSON 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;1. Create a report that shows the Global Fast Foods promotional name, start date, and end date from the f_promotional_menus table. If there is an end date, temporarily replace it with "end in two weeks." If there is no end date, replace it with today's date.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----select name,start_date,NVL2(end_date,'end in two weeks',sysdate)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from f_promotional_menus;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;2. Not all Global Fast Foods staff members receive overtime pay. Instead of displaying a null value for these employees, replace null with zero. Include the employee's last name and overtime rate in the output. Label the overtime rate as "Overtime Status."&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----select last_name,NVL(overtime_rate,0)"Overtime Status"&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from f_staffs;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;3. The manager of Global Fast Foods has decided to give all staff that currently do not earn overtime an overtime rate of $5.00. Construct a query that displays last names and overtime rate shown as $5.00.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----select last_name,to_char(NVL2(overtime_rate,'$5.00','$5.00')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from f_staffs;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;4. Not all Global Fast Foods staff members have a manager. Create a query that displays the employee last name and 9999 in the manager ID column for these employees.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----select last_name,NVL(manager_id,'9999')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from f_staffs;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;5. Which statement(s) below will return null if the value of v_sal is 50?&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;a. SELECT nvl(v_sal, 50) FROM emp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;b. SELECT nvl2(v_sal, 50) FROM emp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;c. SELECT nullif(v_sal, 50) FROM emp;&lt;/span&gt; ----------^.^&lt;br /&gt;&lt;span style="color:#666666;"&gt;d. SELECT coalesce (v_sal, Null, 50) FROM emp;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;6. What does this query on the Global Fast Foods table return?SELECT COALESCE(last_name, to_char(manager_id)) as NAME FROM f_staffs;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----If employees don't have last name, it will label manager id as NAME. And the last name of employees are not null,it will label employees' s last names as NAME. But manager id can never be null because it is the primary key of table.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;7. Part 1: Create a report listing the first and last names and month of hire for all employees in the EMPLOYEES table (use TO_CHAR to convert hire_date to display the month). &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;Part 2: Modify the report to display null if the month of hire is September. Use the NULLIF function.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----select first_name,last_name,NULLIF(to_char(hire_date,'MM'),'09')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from EMPLOYEES;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;8. For all null values in the specialty column in the DJs on Demand d_partners table, substitute "No Specialty." Show the first name and specialty columns only.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----select first_name,NVL(specialty,'No Specialty.')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from d_parents;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;9. Remove the first three numbers of all the phone numbers in the DJs on Demand d_clients table. Show the last name and revised phone number only.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----select last_name,NVL2(phone,substr(phone,4,7),'')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from d_clients;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114153659912731735?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114153659912731735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114153659912731735' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114153659912731735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114153659912731735'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/03/section-2-lesson-2-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114152693764661175</id><published>2006-03-04T17:49:00.000-08:00</published><updated>2006-03-25T08:28:12.636-08:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 2 LESSON 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;1. List the last names and birthdays of Global Fast Food Employees. Convert the birth dates to character data in the Month DD, YYYY format. Suppress any leading zeros.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;----select last_name,to_char(birthdate,'fxMonth DD, YYYY')&lt;br /&gt;from f_staffs;&lt;br /&gt;&lt;br /&gt;2. Convert January 3, 2004, to the default date format 03-JAN-04.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;----select to_date('January 3, 2004','DD MON,YYYY')&lt;br /&gt;from dual;&lt;br /&gt;&lt;br /&gt;3. Format a query from the Global Fast Foods f_promotional_menus table to print out the start_date of promotional code 110 as: The promotion began on the tenth of February 2004.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;----select 'The promotion began on the'//To_char(start_date,'ddth')' of 'to_char(start_date,'Month YYYY')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;from f_promotional_menus&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;where code=110;&lt;br /&gt;4. Convert today's date to a format such as: "Today is the Twentieth of March, Two Thousand Four"&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;----select 'Today is the'//' '//to_char(sysdate,'Ddspth')//' of '//to_char(sysdate,'MONTH')//', '//to_char(sysdate,'YEAR')&lt;br /&gt;from dual;&lt;br /&gt;&lt;br /&gt;5. List the ID, name and salary for all Global Fast Foods employees. Display salary with a $ sign and two decimal places.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;----select employee_id,first_name' 'last_name,to_char(salary,'$999999.99')&lt;br /&gt;from f_staffs;&lt;br /&gt;&lt;br /&gt;6. Ellen Abel is an employee who has received a $2,000 raise. Display her first name and last name, her current salary, and her new salary. Display both salaries with a $ and two decimal places. Label her new salary column AS New Salary.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;----select first_name,last_name,salary,to_number(salary+2000,'$999999.99')+2000 as "New Salary"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;from dual&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;where last_name=Abel;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;7. On what day of the week and date did Global Fast Foods?promotional code 110 Valentine's Special begin?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;----select start_date,to_char(start_date,'D')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;from f_promotional_menus&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;where code=110;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;8. Create one query that will convert 25-DEC-04 into each of the following (you will have to convert 25-DEC-04 to a date and then to character data):&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;December 25th,2004&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;DECEMBER 25TH,2004&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;december 25th, 2004&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;&lt;/span&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;span style="color:#666666;"&gt;----select To_char('20-dec-04','Month ddth,YYYY')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----select to_char('20-dec-04','MONTH ddTH,YYYY')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;----select to_char('20-dec-04','month ddth,YYYY')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;from dual;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;9. Create a query that will format the DJ on Demand d_packages columns, low-range and high-range package costs, in the format $2500.00.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;----select to_char(low_range,'$99999999'),to_char(high_range,'$9999999999')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;from d_packages;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#666666;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;color:#666666;"&gt;10. Convert JUNE192004 to a date using the fx format model.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;----select to_char('JUNE192004','fxMONDD,YYYY')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;color:#666666;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114152693764661175?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114152693764661175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114152693764661175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114152693764661175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114152693764661175'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/03/section-2-lesson-1-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114083506968422106</id><published>2006-02-24T17:34:00.000-08:00</published><updated>2006-03-18T12:03:53.856-08:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 1 LESSON 4 &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;1. Using DUAL, create a function that will convert 86.678 to 86.68.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select round(86.678,2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;2. Create a function that will display the DJ on Demand CD titles for cd_numbers 90 and 91 in uppercase in a column headed "DJ on Demand Collections."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select upper(title) as"DJ on Demand Collections"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from d_cds&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;where cd_number in (90,91);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;3. Create a function that will create computer usernames for the DJ on Demand partners. The usernames will be the lowercase letters of the last name + the uppercase first letter in the first name. Title the column "User Passwords." For example, Mary Smythers would be smythersM.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select lower(last_name)// ' '//upper(instr(first_name,1))as"User Passwords"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from employees&lt;/span&gt; ;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;4. Create a function that will convert " It's a small world" to "HELLO WORLD." &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select upper(replace('it is a small world','it is a small','hello'))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;5. Create a function that will remove the "fiddle" from "fiddledeedee" and the "dum" from "fiddledeedum." Display the result "fiddledeedeedee" in a column with the heading "Nonsense."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select substr('fiddledeedum',1,9)''substr('fiddledeedee',7,5)as"Nonsense"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual&lt;/span&gt; ;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;6. Replace every "i" in Mississippi with "$."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select replace('Mississippi','i','$')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;7. Using DUAL, convert 5332.342 to 5300.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select trunk(5332.342,-2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;8. Using DUAL, convert 3.14159 to 3.14.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select trunc(3.14159,2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;9. Using DUAL, convert 73.892 to 73.8.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select trunc(73.892,1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;10. What is the next Friday six months from now? Label the column "Future."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select next_day(add_months(sysdate,6),'FRIDAY')as"future"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;11. What is the date 10 years from now? Label the column "Future."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select add_months(sysdate,10*12)as"future"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;12. Leap years occur every four years. Remember, 2004 was a leap year. Now create a function that will show the date of the next leap year as 29-FEB-08. Label the column "Future."&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select add_months('29-FEB-04',4*12)as"future"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;13. Create a query that will find any of the DJ on Demand CD themes that have an "ie" in their names.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from d_themes&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;where name='%ie%';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;14. Create a query that will return only the DJ on Demand CDs with years greater than 2000 but less than 2003. Display both the title and year.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select title,year&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from d_cds&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;where year&gt;=2000 and year&lt;=2003;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;15. Create a query that will return the Oracle database employee's employee ID and their starting hire dates between January 1, 1997 and today. Display the result ordered from most recently hired to the oldest.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;----select employee_id,hire_date&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;from employees&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;where hire_date between sysdate and '01-JAN-97'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;order by hire_date;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:130%;color:#666666;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114083506968422106?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114083506968422106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114083506968422106' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114083506968422106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114083506968422106'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/02/section-1-lesson-4-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114083018737562435</id><published>2006-02-24T14:39:00.000-08:00</published><updated>2006-03-18T12:05:27.350-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-family:arial;color:#ff6666;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color:#ff6666;"&gt;SECTION 1 LESSON 3&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:arial;color:#6633ff;"&gt;1. For DJ on Demand, display the number of months between the event_date of the Vigil wedding and today's date. Round to the nearest month.&lt;br /&gt;&lt;br /&gt;----select round(month_between(event_date,sysdate),0)&lt;br /&gt;from d_events&lt;br /&gt;where name=Vigil wedding;&lt;br /&gt;&lt;br /&gt;2. Display the days between the start of last summer's school vacation break and the day school started this year. Assume 30.5 days per month. Name the output "Days."&lt;br /&gt;&lt;br /&gt;----select round(months_between('13-Sep-05','25-Jun-05')*30.5,0) "Day"&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:arial;color:#6633ff;"&gt;from dual&lt;br /&gt;3. Display the days between January 1 and December 31.&lt;br /&gt;&lt;br /&gt;----select (months_between('01-JAN-06','31-DEC-06')/12)*365&lt;br /&gt;from dual;&lt;br /&gt;&lt;br /&gt;4. Using one statement, round today's date to the nearest month and nearest year and truncate it to the nearest month and nearest year. Use an alias for each column.&lt;br /&gt;&lt;br /&gt;----select round(sysdate,'month') "nearest month", round(sysdate,'year') "nearest year", trunc(sysdate,'month') "Nearest Month", trunc(sysdate,'year') "Nearest Year"&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:130%;color:#6633ff;"&gt;from dual;&lt;br /&gt;5. What is the last day of the month for June 2005? Use an alias for the output.&lt;br /&gt;&lt;br /&gt;----select last_day('01-JUN-05')&lt;br /&gt;from dual;&lt;br /&gt;&lt;br /&gt;6. Display the number of years between the Global Fast Foods employee Bob Miller's birthday and today. Round to the nearest year.&lt;br /&gt;&lt;br /&gt;----select round(months_between(sysdate,birthday)/12,'year')&lt;br /&gt;from f_staffs&lt;br /&gt;where first_name='Bob';&lt;br /&gt;&lt;br /&gt;7. Your next appointment with the dentist is six months from today. On what day will you go to the dentist? Name the output, "Appointment."&lt;br /&gt;&lt;br /&gt;----select add_months(sysdate,6) as"Appointment"&lt;br /&gt;from dual;&lt;br /&gt;(Appointment: 24-8月 -06)&lt;br /&gt;&lt;br /&gt;8. The teacher said you have until the last day of this month to turn in your research paper. What day will this be? Name the output, "Deadline."&lt;br /&gt;&lt;br /&gt;----select last_day(sysdate)as "Deadline"&lt;br /&gt;from dual;&lt;br /&gt;(Deadline: 28-2月 -06)&lt;br /&gt;&lt;br /&gt;9. How many months between your birthday this year and January 1 next year?&lt;br /&gt;&lt;br /&gt;----select months_between('27-MAY-06','01-JAN-07')&lt;br /&gt;from dual;&lt;br /&gt;&lt;br /&gt;10. What's the date of the next Friday after your birthday this year? Name the output, "First Friday."&lt;br /&gt;&lt;br /&gt;----select next_day('27-MAY-06','friday')as"First Friday"&lt;br /&gt;from dual;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114083018737562435?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114083018737562435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114083018737562435' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114083018737562435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114083018737562435'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/02/section-1-lesson-3-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-114082049590552320</id><published>2006-02-24T12:53:00.000-08:00</published><updated>2006-03-18T12:04:57.936-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="color:#ff6666;"&gt;SECTION 1 LESSON 2 &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#9999ff;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:arial;"&gt;1. Display Oracle database employee last_name and salary for employee_ids between 100 and 102. Include a third column that divides each salary by 1.55 and rounds the result to two decimal places.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----select last_name,round(salary/1.55,2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from employees&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;where employee_id between 100 and 102;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;2. Display employee last_name and salary for those employees who work in department 80. Give each of them a raise of 5.33% and truncate the result to two decimal places.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----select last_name,salary,trunc(salary+salary*0.0533,2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from employees&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;where department_id=80;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;3. Use a MOD number function to determine whether 38873 is an even number or an odd number.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----select mod(38873,2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;(the remainder is 1, so 38873 is an odd number.)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;4. Use the DUAL table to process the following numbers:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;845.553 - round to one decimal place&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;30695.348 - round to two decimal places&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;30695.348 - round to -2 decimal places&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;2.3454 - truncate the 454 from the decimal place&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----select round(845.553,1) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;select round(30695.348,2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;select round(30695.348,-2)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;select trunc(2.3454,1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;5. Divide each employee's salary by 3. Display only those employees?last names and salaries who earn a salary that is a multiple of 3.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----select last_name,salary&lt;/span&gt; ,mod(salary,3)&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from employees&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;where mod(salary,3)=0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;6. Divide 34 by 8. Show only the remainder of the division. Name the output as EXAMPLE.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----select mod(34,8)as"EXAMPLE"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;from dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;7. How would you like your paycheck -- rounded or truncated? What if your paycheck was calculated to be $565.784 for the week, but you noticed that it was issued for $565.78. The loss of .004 cent would probably make very little difference to you. However, what if this was done to a thousand people, a 100,000 people, or a million people! Would it make a difference then? How much difference?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;----I would like my paycheck to be rounded,haha.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-114082049590552320?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/114082049590552320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=114082049590552320' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114082049590552320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/114082049590552320'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/02/section-1-lesson-2-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113989262872151036</id><published>2006-02-13T20:04:00.000-08:00</published><updated>2006-03-18T12:04:27.283-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="color:#ff6666;"&gt;SQL SECTION 1 LESSON 1&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;1. Using the three separate words "Oracle," "Internet," and "Academy," use one command to produce the following output: The Best Class Oracle Internet Academy&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;---- SELECT CONCAT('Oracle',' Internet')//' Acameny' AS"The Best Class"&lt;br /&gt;From dual;&lt;br /&gt;&lt;br /&gt;2. Use the string "Oracle Internet Academy" to produce the following output: The Net net&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;---- SELECT SUBSTR('Oracle Internet Academy',13,3)AS"The Net"&lt;br /&gt;FROM dual;&lt;br /&gt;&lt;br /&gt;3. What is the length of the string "Oracle Internet Academy"?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;---- SELECT LENGTH('Oracle Internet Academy')&lt;br /&gt;FROM dual;&lt;br /&gt;&lt;br /&gt;4. What's the position of " I " in "Oracle Internet Academy"?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;---- SELECT INSTR('Oracle Internet Academy','I')&lt;br /&gt;FROM dual;&lt;br /&gt;&lt;br /&gt;5. Starting with the string "Oracle Internet Academy", pad the string to create ?***Oracle****Internet****Academy****&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;---- SELECT LPAD(RPAD('Oracle',10,'*')RPAD('Internet',12,'*')RPAD('Academy',11,'*'),37,'*')&lt;br /&gt;FROM dual;&lt;br /&gt;6. Starting with the string "Oracle Internet Academy", pad the string to produce Oracle$$$Internet$$$Academy&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;---- SELECT RPAD(SUBSTR('Oracle Internet Academy',1,6),9,'$')RPAD(SUBSTR('Oracle Internet Academy',8,8),11,'$')SUBSTR('Oracle Internet Academy',17,7)&lt;br /&gt;FROM dual;&lt;br /&gt;&lt;br /&gt;7. Using the string 'Oracle Internet Academy', produce the output shown using the REPLACE function.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;---- SELECT REPLACE('Oracle Internet Academy','Internet','2004-2005')AS"The Best Class"&lt;br /&gt;FROM dual;&lt;br /&gt;&lt;br /&gt;8. List the order date and the order total from the Global Fast Foods F_ORDERS table. Name the order total as TOTAL, and fill in the empty spaces to the left of the order total with $.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;---- SELECT order_date,LPAD('order total',16,'$') AS"TOTAL"&lt;br /&gt;FROM F_ORDERS;&lt;br /&gt;&lt;br /&gt;9. Write a query that will output a column called ADDRESS?which has the following information: ZOE TWEE 1009 OLIVER AVENUE BOSTON, MA 12889. Use the Global Fast Foods F_CUSTOMERS table.&lt;br /&gt;&lt;br /&gt;----select first_name' 'last_name' 'Address' 'city', 'state' 'zip "ADDRESS"&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;color:#ff9966;"&gt;from f_customerswhere id=456&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#666666;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113989262872151036?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113989262872151036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113989262872151036' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113989262872151036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113989262872151036'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2006/02/sql-section-1-lesson-1-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113574867937249471</id><published>2005-12-27T21:42:00.000-08:00</published><updated>2005-12-28T18:43:18.970-08:00</updated><title type='text'></title><content type='html'>&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/sec6les1.jpg"&gt;&lt;img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/5710/1349/320/sec6les1.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;SECTION 6 LESSON 1&lt;/span&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/?????????1.1.jpg"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113574867937249471?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113574867937249471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113574867937249471' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113574867937249471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113574867937249471'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-6-lesson-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113574393779007765</id><published>2005-12-27T20:24:00.000-08:00</published><updated>2005-12-27T20:25:37.790-08:00</updated><title type='text'></title><content type='html'>&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/sec5les2.jpg"&gt;&lt;img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/5710/1349/320/sec5les2.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;SECTION 5 LESSON 2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;(a) Each CLUB must be assigned to one and only DEPARTMENT&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;(b) Each DEPARTMENT may be responsible for one or more CLUBs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;(c) Each STUDENT may join one or more CLUBs&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;(d) Each CLUB may be composed of one or more STUDENTs&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113574393779007765?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113574393779007765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113574393779007765' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113574393779007765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113574393779007765'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-5-lesson-2-each-club-must-be.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113522663485189940</id><published>2005-12-21T20:35:00.000-08:00</published><updated>2005-12-27T20:09:16.076-08:00</updated><title type='text'></title><content type='html'>&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/video.jpg"&gt;&lt;img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/5710/1349/320/video.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/1.0.jpg"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;VIDEO STORE&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113522663485189940?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113522663485189940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113522663485189940' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113522663485189940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113522663485189940'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/video-store.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113522610726607093</id><published>2005-12-21T20:32:00.000-08:00</published><updated>2005-12-28T18:45:33.340-08:00</updated><title type='text'></title><content type='html'>&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/sec5les1.jpg"&gt;&lt;img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/5710/1349/320/sec5les1.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/?????????1.0.jpg"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/section5%20lesson1.jpg"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;SECTION 5 LESSON 1&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113522610726607093?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113522610726607093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113522610726607093' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113522610726607093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113522610726607093'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-5-lesson-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113522583593464227</id><published>2005-12-21T20:19:00.000-08:00</published><updated>2005-12-27T20:14:41.763-08:00</updated><title type='text'></title><content type='html'>&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/fast%20food.1.jpg"&gt;&lt;img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/5710/1349/320/fast%20food.1.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/5710/1349/1600/fast%20food.0.jpg"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;SECTION 4 LESSON 3&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113522583593464227?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113522583593464227/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113522583593464227' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113522583593464227'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113522583593464227'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-4-lesson-3.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113462016599229327</id><published>2005-12-14T19:57:00.000-08:00</published><updated>2005-12-14T20:27:49.850-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="color:#ff6666;"&gt;SECTION 3 LESSON 3 &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;B. Each employee may be assigned to one and only one department.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;Each department may be responsible for one or more employees.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;Each person must be born in one and only one town.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;Each town may be the birthplace of one or more persons.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;Each person must be living in one and only one town.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;Each town may the hometown of one or more persons.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;Each person may be the visitor of one or more towns.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;Each town may be visited by one or more persons.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;Each person may be the mayor of one and only one town.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;Each town must be governed by one and only one person.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#ffcc33;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113462016599229327?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113462016599229327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113462016599229327' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113462016599229327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113462016599229327'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-3-lesson-3-b.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113461701509354722</id><published>2005-12-14T17:39:00.000-08:00</published><updated>2005-12-14T20:27:24.676-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="color:#ff6666;"&gt;SECTION 3 LESSON 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#339999;"&gt;HARISTYLIST: first name(m), last name(m), address(o), phone number(o),&lt;span style="color:#ff0000;"&gt; social-security&lt;/span&gt; number(m), salary(m)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#339999;"&gt;CILENT: first(m), last name(o), phone number(o)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#339999;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#339999;"&gt;Each haristylist may be assigned by one or more cilents.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#339999;"&gt;Each cilent must assign one and only oneharistylist.&lt;/span&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113461701509354722?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113461701509354722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113461701509354722' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113461701509354722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113461701509354722'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-3-lesson-2-haristylist-first.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113433489608553216</id><published>2005-12-11T12:27:00.000-08:00</published><updated>2005-12-11T13:01:36.096-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-size:130%;color:#ff6666;"&gt;SECTION 3 LESSON 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;a.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;each job may be handled by one or more employees.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;each empolyee must handle one or more jobs. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;b.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;each assigned waiter may take one or more orders.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;each order must be taken one assigned waiter.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;c.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;each parent may pick up one or more children.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;each child must be picked up by one parent.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;d.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#339999;"&gt;each teacher may teach one or more students.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color:#339999;"&gt;each student must be taught by one or more teachers&lt;/span&gt;.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113433489608553216?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113433489608553216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113433489608553216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113433489608553216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113433489608553216'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-3-lesson-1.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113433285026536402</id><published>2005-12-11T11:53:00.000-08:00</published><updated>2005-12-11T12:32:04.580-08:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 2 LESSON 4&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;&lt;/span&gt;&lt;br /&gt;Using the partial ERD of a restaurant with entities ORDER, FOOD ITEM, AND CUSTOMER, identify the attributes for each entity.&lt;br /&gt;If possible, indicate whether the attribute is mandatory or optional. Can you pick out the UIDs for each entity?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color:#33cc00;"&gt;A.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;ORDER-----&lt;span style="color:#ff0000;"&gt; order number&lt;/span&gt;, price&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;FOOD ITEM----- single price, &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;food name&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;CUSTOMER----- last name, first name, address&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;B.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;1.what does this report mean?&lt;/span&gt;&lt;br /&gt;2.what data was collected?&lt;br /&gt;3.what information does this table provide?&lt;br /&gt;4.how do tou think these data are used?&lt;br /&gt;5.generate five conclusions based on the data provided.&lt;br /&gt;6.generate three questions that you could ask about the data provided.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;1.the report shows the situation of the sale of different foods and the source of sales&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;2. 12/02/2003&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;3. numbers of the different foods sales and numbers of defferent source sales&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;4.compare which kind of food is popular and which group is the major customers&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;5.a. the students are the mojar customers&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;b. hamburger/taco bar is the most popular food&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;c. pizza bar is more popular&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;d. faculty/staff aslo buy foods&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;e. the fewest customers that buy foods and foods comparing to last days at last day&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;6.a. why fewer faculty/staff buy foods?&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;b. why is hamburger/taco bar most popular?&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;c. why do fewest foods sold at last day?&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113433285026536402?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113433285026536402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113433285026536402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113433285026536402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113433285026536402'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-2-lesson-4-using-partial-erd.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113433077316692899</id><published>2005-12-11T10:46:00.000-08:00</published><updated>2005-12-23T17:09:09.333-08:00</updated><title type='text'></title><content type='html'>&lt;span style="color:#ff6666;"&gt;SECTION 2 LESSON 3&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color:#3366ff;"&gt;Concept E/A/I ? Example Instance or Entity&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#333333;"&gt;vehicle ,E, bus&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#333333;"&gt;diet coke ,I, cocacoke&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#333333;"&gt;price ,A ,product&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#333333;"&gt;cumtomer number ,A ,service center&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#333333;"&gt;green ,A ,color&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#333333;"&gt;奥力奥, E, cookie&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#333333;"&gt;color ,A, cookie&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#333333;"&gt;food, I ,cookie&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#333333;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6666cc;"&gt;SONG ----- title, release date, type&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6666cc;"&gt;EVENT----- title, description, venue&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6666cc;"&gt;CUSTOMER----- first name, phone number, last name, email address&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6666cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;Entity: STUDENT&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;Attributes: &lt;span style="color:#ff0000;"&gt;student ID&lt;/span&gt;, first name, last name, address&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;Entity: MOVIE&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;Attributes: title, &lt;span style="color:#ff0000;"&gt;date released&lt;/span&gt;, producer, director&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;Entity: LOCKER&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;Attributes: size, location, &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;number&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113433077316692899?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113433077316692899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113433077316692899' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113433077316692899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113433077316692899'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-2-lesson-3-concept-eai-example.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-113432678894285736</id><published>2005-12-11T10:30:00.000-08:00</published><updated>2005-12-11T11:45:08.176-08:00</updated><title type='text'></title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="color:#ff6666;"&gt;SECTION 2 LESSON 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;Discuss the business of a barbershop/hair salon. Can you name the entities that are the 搈ain things?about this business? Can you name instances of each entity?&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff6666;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ffcc33;"&gt;customer( dacong), hairdresser( jiangshan),equipment( forfex ), newspaper( world journal ), ornament flower),&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-113432678894285736?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/113432678894285736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=113432678894285736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113432678894285736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/113432678894285736'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/12/section-2-lesson-2-discuss-business-of.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-17424341.post-112839300579807726</id><published>2005-10-03T18:54:00.000-07:00</published><updated>2005-10-03T20:29:39.030-07:00</updated><title type='text'></title><content type='html'>a) What are the typical tasks involved in this job?&lt;br /&gt;b) What kind of social, problem-solving, or technical skills are required?&lt;br /&gt;c) What are the physical demands of the job?&lt;br /&gt;d) What kind of training/education is required for the job?&lt;br /&gt;e) Where are current job openings?&lt;br /&gt;f) What other jobs could be a starting job that leads to this career?&lt;br /&gt;g) How many different kinds of businesses use these job skills?&lt;br /&gt;h) What is the salary range?&lt;br /&gt;&lt;br /&gt;a)Cite examples of the jobs, salary, and opportunities that could result from participating the Academy.&lt;br /&gt;b)The Oracle Academy Teacher-led/project-driven+I.T. industry-recognized certification +Higher-Education options=21st-century economic viability.&lt;br /&gt;c)Higher education.&lt;br /&gt;d)Database Design, Database Programming,Java Programming,Java Database Applications&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/17424341-112839300579807726?l=daconghomework.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://daconghomework.blogspot.com/feeds/112839300579807726/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=17424341&amp;postID=112839300579807726' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/112839300579807726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17424341/posts/default/112839300579807726'/><link rel='alternate' type='text/html' href='http://daconghomework.blogspot.com/2005/10/what-are-typical-tasks-involved-in.html' title=''/><author><name>大葱~~~~~~~</name><uri>http://www.blogger.com/profile/04179251749245405446</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://photos1.blogger.com/blogger/5710/1349/1600/01_26_24_225746.jpg'/></author><thr:total>1</thr:total></entry></feed>
