lesphomework

this is a crazy site for crazy people

Sunday

section 5

SQL - Section 5
Lesson 4
1. Create a query that will show the average cost of the DJ on Demand events. Round to two decimal places.
Select round(avg(cost),2) from d_events;

2. Find the average salary for Global Fast Foods staff members whose manager ID is 19.
Select avg(salary) from f_staffs where manager_id=19;

3. Find the sum of the salaries for Global Fast Foods staff members whose IDs are 12 and 9.
Select sum(salary) from f_staffs where id in(9, 12);

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.
Select min(salary), max(hire_date), max(last_name), min(last_name) from employees where department_id in(50, 60);

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?

SELECT sum(total_sales)FROM orders; 1


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?

March 30, 1969

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.

Select avg(order_number) from f_orders where order_date between '01-Jan-02' and'31-Dec-02';
9. What was the hire date of the last Oracle employee hired?
Select max(hire_date) from employees
1
0. In the following SELECT clause, which value returned by the SELECT statement will be larger?
SELECT SUM(operating_cost), AVG(operating_cost)
Sum(operating_cost)


Lesson 5
1. How many songs are listed in the DJs on Demand D_SONGS table?
Select count(title) from d_songs;
6
2. In how many different location types has DJs on Demand had venues?
Select count(distinct loc_type) from d_venues;
4
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?
Select count(song_id), count(distinct cd_number) from d_track_listings;
5, 4
4. How many of the DJs on Demand customers have email addresses? Select count(email) from d_clients;
3
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?Select count(distinct auth_expense_amt) from d_partners;
1
6. Using the table shown, what values will be returned when the following statement is issued?SELECT COUNT(shoe_color), COUNT(DISTINCT shoe_color)FROM shoes;
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.
Select count(auth_expense_amt), round(avg(nvl(auth_expense_amt, 0)), 2) from d_partners;
8. Refer to the DJs on Demand database D_EVENTS table shown.
Which clauses represent valid statements?From_____a. FROM event_date Sum______b. SELECT SUM(cost) Sum______c. SELECT SUM(event_date) Avg______d. SELECT description, AVG(cost) AS "Expense"Where______e. WHERE MIN(id) = 100Max______ f. SELECT MAX(AVG(cost) Min_____ g. SELECT MIN(event_date)
9. Which statement(s) is/are True about the following SQL statement:SELECT AVG(NVL(selling_bonus, 0.10))FROM bonuses; T_____a. The data types of the values in the NVL clause can be any data type except date data._____b. If the selling_bonus column has a null value, 0.10 will be substituted.T_____c. There will be no null values in the selling_bonus column when the average is calculated.F _____d. This statement will cause an error. There cannot be two functions in the SELECT statement.
10. Which of the following statements is/are TRUE about the following query?SELECT DISTINCT colors, sizesFROM items;T_____a. Each color will appear only once in the results set.F_____b. Each size will appear only once in the results set.F_____c. Unique combinations of color and size will appear only once in the results set.T_____d. Each color and size combination will appear more than once in the results set.

40 Comments:

At 9:46 PM, Blogger 相處 said...

far from eye, far from heart. ....................................................

 
At 1:01 AM, Blogger 3d電影 said...

上班好累哦,看看部落格轉換心情~~~先謝謝啦!!........................................

 
At 2:08 PM, Blogger lady said...

路過看看哦,請加油 ........................................

 
At 10:03 PM, Blogger pass said...

成人無碼片線上看18限成人影片論壇成人鴛鴦成人影片鴛鴦吧成人影片a正妹百人斬a影片免費看a騙bbsx693bonbonme線上觀看bt成人分享bt免費論壇bt後宮cb 倉井空影片cb倉井空影片cf聊天室dudu貼片dudu嘟嘟區dvd 卡通色情片a影片卡通a網情色片a漫網址a色情圖片a免費卡通影片a免費看片a免費情色影片a免費影片觀看a免費線上直播a免費線上觀賞a我愛78論壇視訊辣妹亞洲情色風暴貼圖交友聊天找e爵aio交友愛情館

 
At 2:03 AM, Blogger 曉豪 said...

快下班囉~來問個安,跟您打聲招呼 ........................................

 
At 10:29 PM, Blogger 佩昭彥怡 said...

沈舟側畔千帆過,病樹前頭萬木春......................................................

 
At 6:55 AM, Blogger NicolaSigel0508 said...

憂能傷身,保重哦!.........................

 
At 8:39 PM, Blogger AronArendt0418 said...

thank you for you to make me learn more,thank you∩0∩ ........................................

 
At 11:13 PM, Blogger CasandraC文行 said...

最豐滿最好之稻穗,便最貼近地面..................................................

 
At 9:40 PM, Blogger 羿惟 said...

初次造訪~安安^^ .........................................

 
At 10:48 AM, Blogger 健豪 said...

nice to meet you~.................................................................

 
At 9:29 AM, Blogger 韋于倫成 said...

死亡是悲哀的,但活得不快樂更悲哀。.........................

 
At 4:24 PM, Blogger 建霖 said...

嫉妒能使人得到短暫的快感,但也能使不幸更辛酸。 ..................................................

 
At 1:22 AM, Blogger 退 said...

你的blog超棒 ....................................................

 
At 12:48 PM, Blogger 佩GailBohanan1蓉 said...

世間是非,要如水泥地般水過則乾。............................................................

 
At 12:48 AM, Blogger rodriguezp said...

北台灣視訊aio34c正妹 69成人網 080視訊聊天室iww 線上免費看成人片 百分百成人圖片 辣妹妹影音視訊聊天室 視訊交友551281 kk 視訊聊天室 免費a片 sex-情色視訊 夜未眠成人影城 視訊聊天網 aaa片免費看短片 正妹交友go uouo 視訊聊天交友 hi5 tv免費影片 av女優王國 546視訊聊天室 免費影音視訊聊天室 ut 視訊聊天室 sex story,辣妹影片直播 hilive成人情色網 線上a長片 美眉脫內衣影片 sex888入口aio甜心寶貝直播貼片 彩虹免費av影片 亞洲東洋視訊辣妹影片 視訊交友網fm358 love104 影音城 qk999成人論壇 免費視訊gogo 拓網學生族視訊777美女 免費成人影片sex,av女優 a 免費影片觀賞 免費視訊topchurch 免費線上 aa 片試看85CC 高雄援交本土自拍天堂 成人視訊elove 臺灣情色網hilive tv 546 視訊聊天室 線上免費av影片 視訊ggoo xvediox松島楓免費影片 免費聊天室 aa影音視訊聊天室 一對多視訊免費視訊辣妹 j 我愛 78 論壇 免費 a 片 兼職援交 免費a自拍偷拍g世代論壇

 
At 6:45 PM, Blogger 佳皓 said...

快樂是你與生俱來的權力,它不應該取決於你完成什麼。 ......................................................................

 
At 8:07 PM, Blogger 雅馨 said...

這個時代,不缺乏感傷,但缺乏反思~~希望能多看到值得思考.................................................................

 
At 12:56 PM, Blogger 姿穎 said...

一個人的價值,應該看他貢獻了什麼,而不是他取得了什麼....................................................................

 
At 8:43 PM, Blogger 鈺禎蕭 said...

君子立恆志,小人恆立志。.................................................................                           

 
At 7:34 AM, Blogger 秋娥秋娥 said...

人不能像動物一樣活著,而應該追求知識和美德............................................................

 
At 5:20 PM, Blogger 宜FH定博林P'韓T彥 said...

向著星球長驅直進的人,反比踟躕在峽路上的人,更容易達到目的。............................................................

 
At 10:23 PM, Blogger 童雅 said...

Quality is better than quantity.............................................................

 
At 10:13 PM, Blogger 懿綺懿綺 said...

留言是種美德-感謝分享..................................................................

 
At 2:08 AM, Blogger 嘉剛怡元 said...

好熱鬧喔 大家踴躍的留言 讓部落格更有活力..................................................................

 
At 2:09 AM, Blogger 趙坤然趙坤然 said...

喜歡看大家的文章,每篇都是一個故事,都是一種心情~~祝大家開心愉快............................................................

 
At 5:57 PM, Blogger 茹希茹希 said...

臨淵羨魚,不如退而結網。............................................................

 
At 1:38 AM, Blogger 宜欣宜欣 said...

Great minds think alike...................................................

 
At 6:29 PM, Blogger 王美妹 said...

生存乃是不斷地在內心與靈魂交戰;寫作是坐著審判自己。. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

 
At 6:29 PM, Blogger 吳婷婷 said...

Share and share alike.............................................................

 
At 1:05 PM, Blogger 琬安琬安 said...

「仁慈」二個字,就能讓冬天三個月都溫暖。.......................................................

 
At 2:52 AM, Blogger 盈廖生家秀蔡 said...

Look before you leap.................................................

 
At 2:32 AM, Blogger 黃子軒 said...

知識可以傳授,智慧卻不行。每個人必須成為他自己。. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

 
At 12:46 PM, Blogger 凱v胡倫 said...

Knowledge is a treasure, but practice is the key to it.................................................

 
At 5:42 AM, Blogger 家唐銘 said...

It is easier to get than to keep it.......................................................................

 
At 12:30 AM, Blogger 凱v胡倫 said...

感動 + 感恩 + 感謝(。-ˍ-。 )............................................................

 
At 6:05 PM, Blogger 張韓涵旺建宇 said...

人類的聰明,並非以經驗為依歸,而是以接受經驗的行程為依歸。..................................................

 
At 12:56 AM, Blogger 瑜陳陳陳陳真 said...

Quality is better than quantity...................................................................

 
At 1:20 AM, Blogger 佳張張張張燕張張張張張 said...

用行動來支持你~~~不留言不行!............................................................

 
At 6:30 AM, Blogger 建枫 said...

在莫非定律中有項笨蛋定律:「一個組織中的笨蛋,恆大於等於三分之二。」. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

 

Post a Comment

<< Home