Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Fachbereich Wirtschaftswissenschaften Institut für Wirtschaftsinformatik Professur für Mobile Business & Multilateral Security Fachbereich Wirtschaftswissenschaften Exercise Business Informatics 2 (PWIN) Winter Term 2013/14 Institut für Wirtschaftsinformatik Professur für Mobile Business & Multilateral Security www.m-chair.net Prof. Dr. Kai Rannenberg Telefon +49 (0)69-798 34701 Telefax +49 (0)69-798 35004 E-Mail [email protected] Exercise VI: SQL Sascha Koschinat, Dipl.-Kfm. E-Mail [email protected] Shuzhe Yang, M.Sc. E-Mail [email protected] Exercise 1: SQL Statements The database InstantONS® consists of two tables: Table: Customer_data Table: Customer_interests Campus Westend • Grüneburgplatz 1 • D-60323 Frankfurt am Main H i e r w i r d W i s s e n W i r k l i c h k e i t Write the appropriate SQL statements to answer the following questions and draw the table which will be returned as a result. a) How many customers are stored in the table „Customer_data“? b) What is the average weight over all InstantONS® users? c) What is the weight of the heaviest customer? d) How many people were logged in per day? e) How many male (female) users do exist in InstantONS®? f) Display the Usernames of all users born in 1975. g) Display the “Username“ and “Birthdate” of all users, sorted descending. h) How many users are “topfit“? i) How many users are “unfit“? j) Display the “Username”, “Gender” and the first two hobbies of each user. k) How many users are female and are playing „Video games“ as first or second hobby? l) How many users are “single“, but do have kids? m) Display the “Username”, “Gender”, “Size” and the according hobbies of each user. n) How many users registered for InstantONS® in 2006? o) Display the “Username”, “Haircolor” and the first hobby of all users. p) Insert a data record into the table “Customer_data“ and display it with all attributes. q) Insert a data record into the table “Customer_data“ and display it with “CustomerID” and “Hobby2” only. r) Update the “Weight” of the user with the CustomerID „2057454“ to 62 kilograms. s) Delete the entry inserted in Exercise p). u) Delete the whole table „Customer_interests“. v) Delete the whole database. Page 2