SQL-Tutor texts This document contains all feedback messages, problems and other texts incorporated into SQL-Tutor. The document is developed for proofreading purposes. Problems for students to solve 1. List full details of all employees. 2. Retrieve the birthdate and address of the employee whose name is John Smith. 3. Retrieve the name and address of all employees who work for the Research department. 4. For every project located in Stafford, list the project number, the controlling department number and the manager's last name, address and birthdate. 5. For each employee, retrieve the employee's first and last name and the first and last name of his or her immediate supervisor. 6. Select all employees' IRDs. 7. Select all combinations of employee IRD and department name. 8. List all information about employees of department 5. 9. Retrieve the salary of every employee. 10. Retrieve the IRDs of all employees who work on project number 1, 2, or 3. 11. Find the names of employees whose salary is greater than the salary of all the employees in department 5. 12. Retrieve the name of each employee who has a dependent with the same first name and same sex as the employee. 13. Retrieve the names of employees who have no dependents. 14. Retrieve the names of all employees who do not have supervisors. 15. Find the names of all employees whose salary is greater than 30000 and less then 50000 per year. 16. Retrieve the names of all employees whose address is in Houston, Texas. Assume that a matching address would contain string ‘Houston,TX’ (without a space in between). 17. Retrieve the names of all employees who were born during the 1950s. 18. Find how many employees work on more than two projects. 19. Show the names of employees and the resulting salaries if every employee working on the 'ProductX' project is given a 10% raise. 20. Find the sum of salaries of all employees, the maximum salary, the minimum salary and the average salary. 21. Retrieve the number of employees in the 'Research' department. 22. Retrieve the names of all employees who have more than two dependents. 23. For each department, retrieve the department number, the number of employees in the department, and their average salary. 24. For each project on which more than two employees work, retrieve the project number, the project name, and the number of employees who work on the project. 25. Retrieve a list of all employees’ names, department names and the names of projects they are working on, ordered by department (descending) and, within each department, alphabetically by last name, first name. 26. List full details of all movies. 27. Produce a list of all movies, showing only the movie number, title and director number. 28. What is the name of customer number 124? 29. List the names of all directors born in or after 1920. 30. List the titles and numbers of all movies that have won at least one Academy Award and have been made in or after 1988. 31. List the titles of all comedies or dramas. 32. List the titles of all movies that have a critics rating. Note that the fact that a movie has not been rated is encoded in the database as 'NR'. 33. Produce a list of customer names, numbers and bonuses, under the assumption that the BONUS attribute does not exists in the CUSTOMER table, but can be computed as one tenth of the RENTALS attribute. 34. Produce a list of star numbers of all the stars that acted in the movie number 20. 35. List the numbers and titles of all movies made between 1990 and 1993." 36. List the numbers and titles of all movies whose type is comedy or drama. 37. For all customers who live in Ilam, list their number and name. 38. Retrieve the names of all directors born during the 1950s. 39. List the names of all directors who are still living. 40. List the titles of all movies and the number of awards won by each. Arrange the result in descending order of the number of Academy Awards won. 41. List the numbers, names, addresses and join dates of all members. Sort the output by last name descending and by first name ascending. 42. How many movies won more than four Academy Awards? 43. Find how many comedies there are and how many AA they won. 44. Find the number of movies in each category and the total of AA won in each of them. Show categories as well. Define aliases for the number of movies and the total number of awards. 45. For each director, list the director's number and the total number of awards won by comedies he or she directed if the total is greater than 1. 46. List the numbers and names of all members who have rented more tapes than average. 47. List the titles of all movies directed by Stanley Kubrick. 48. Retrieve the titles of all movies directed by Stanley Kubrick. 49. Select all combinations of movie titles and tape codes. 50. List the names and addresses of all customers currently renting movies starring Mel Brooks. 51. Find the numbers and names of all directors who have directed at least one comedy. 52. List the names and numbers of all members. For those of them who are currently renting tapes, list the total number of tapes. 53. List the movie number and title for all movies that were nominated for more Academy Awards than any movie directed by Woody Allen. 54. Find the list of any pairs of stars who have the same first name. 55. List the tape numbers of all tapes that have been rented at least 10 times. 56. List the numbers, names and ages of all movie stars who are deceased. 57. Find the number and name of the youngest director who has directed at least one comedy. 58. For all directors who made more than 5 movies, list their number, names and the total number of movies. 59. List full details of all vehicles. 60. Show the number of movies of each type made in 1980. 61. Find the name of the director who has directed the most movies. Show the number of movies as well. 62. Show types of movies for which there are more than 5 movies in the database. Order the results by decreasing number of movies. The number of movies in each category should be shown as a column named NO. 63. Find the name of the star who played Vronsky in the movie entitled 'Anna Karenina'. 64. Find the names and numbers of all directors who directed at least as many movies as the director number 0015. 65. Get names and addresses of all owners from Christchurch who registered their vehicles during March 1996. 66. Get the list of vehicles imported from Japan since 1985 which had less than 3 owners in New Zealand, listing their plates, makes and models. 67. Find how much money was collected in the organisation 1352 on February 15 1997 for registration of private cars. 68. List full details of all compositions. 69. Produce a list of all compositions, showing only the masterpiece's number, title and composer number. 70. What is the name of composer number 12? 71. List the titles and numbers of all operas. 72. List the names of all composers born in the eighteenth century. 73. List the titles of all concertos or symphonies. 74. List the types of compositions made in the romantic era. 75. For each composer, list the composer's number and the total number of compositions. 76. List the titles of all masterpieces composed by Frederic Chopin. 77. For all composers who made more than 3 operas, list their numbers, names and the total number of operas. 78. Find the name of the composer who has composed the most symphonies. Show the number of symphonies too. 79. Show types of compositions for which there are more than 5 compositions in the database. Order the results by decreasing number of compositions. The number of compositions in each category should be shown as a column NO. 80. Find the names and numbers of all composers who composed at least as many masterpieces as the composer number 6. 81. For all chamber music composed during the classical era for strings but not involving a piano, in any major key, show the title of the piece, the name of the composer and the country he was born in. 82. Show the name and number of each composer and for each type of music the number of compositions. Order by last names. 83. Show all publishers. 84. For each book, show its id, title, and the total number of copies in the library. 85. For each publisher, show the publisher and the title of the book that has the largest number of copies held in the library. 86. Find the publishers whose books are stored in more than one branch. 87. Find the titles and ids of all books written by two authors. 88. Find the authors whose books are stored in more than one branch. 89. Show the name and address of all the branches that contain the 'Database Systems' book. 90. For each book written by 'J Widom', show the id of the book, the id of the branch and the number of copies in that branch. 91. Show all the authors' names. 92. Show the ids and names of all branches that contain books published by Addison-Wesley. 93. Show the name of each author and the total number of copies of his/her books available in the library. 94. For each book, show its title, the author's name and the id of the branch where that book is held 95. For each publisher, show the publisher and the title of the books that have at least two copies in the library. 96. Find the title of books written by more than two authors. 97. Show the titles of all books. 98. Find the id, title and the publisher of the book(s) that have 3 copies in Central branch. 99. List the details of each branch. 100. Show the address of CEN branch. 101. Show types of products." #("distinct type" "PRODUCT" "" "" "" "")) 102. For each product, show its name, the department name and the total quantity delivered by all suppliers. 103. For each supplier, show the supplier name and the name of the product that had the highest quantity delivered to all departments. Show the quantity too." 104. List the names of suppliers who deliver to more than one department." 105. Find all products that are delivered by exactly three suppliers." 106. Show the colour of all products of type C. 107. Show the name of each supplier, and for each department that supplier has made deliveries to, show the department name and the total number of deliveries. 108. List the name and number of each supplier who supplies at most two departments. 109. Find the name and the phone number of each department that has had deliveries by 'Books and More'. 110. For each product, find its name and the total quantity delivered. 111. Find the name and type of each product which has been delivered in quantity of 10. 112. Find the name and type of each product that is supplied by at least two suppliers. 113. For each supplier, show the supplier number and the name of each department delivered to by the supplier. Show the suppliers' numbers in descending order and department names in ascending order. 114. For each product, show its name, the department name to which the product has been delivered, and the quantity delivered. 115. Show the names of departments located on the 5th floor. 116. List the names of suppliers who deliver to the 'Accounting' department. 117. For delivery number 75, show the supplier's name, and the type of the product delivered. 118. Show years when the total of all donations reached or exceeded the plan. 119. For each year, show the number of donations and the total." 120. Find the numbers and names of sponsors who made more than one donation in a single year. Show the year and the number of donations too. 121. Show all details of the sponsor who has donated most money over the years." 122. For each sponsor who has made more than three donations, show his/her name and city. 123. For each year, show the number of sponsors and the total amount of donation. 124. Show the ids and names of the sponsors who have donated more than the total amount that Joana Burneman has donated. 125. For each year show the average donation. 126. Find the city, name and phone number of all the sponsors. 127. Show each year and the maximum donation in that year as MAX_DON. Sort the results in descending order of MAX_DON. 128. For each sponsor, show all of his/her details and the total amount of donations made. 129. Find the number of sponsors from New York in the database. 130. Show the year with the biggest year goal. 131. Find the yeargoals from 1995 to 1997. 132. Show all years and the goals. 133. Show the details of sponsors who live in New York. 134. Show the name and state of each sponsor. 135. List the details of each sponsor. 136. For each sponsor, find his/her last name and the number of years in which (s) he has donated money, but only if it is greater than 1. 137. Find manufacturers whose computers are faster than some computer produced by manufacturer C, and which have more than 500MB of RAM. Show the corresponding models too. 138. For each type of product, find how many different models there are. 139. Find manufacturers who make more than one model of the same type of printers (e.g., two models of laser printers). Show the type of printers too. 140. Show the model number, price and manufacturer of the most expensive ink-jet printer. 141. For each printer, show its type, price and manufacturer. 142. For each PC that has more than 600MB of RAM, show the model number and manufacturer. 143. Find the cheapest laser printer. Show the model number, price and maker. 144. For each speed available, find how many different RAM sizes are available. Show the name of manufacturers too. 145. List the product details produced by manufacturer D. 146. Find the total price of the products produced by manufacturer A 147. For each manufacturer, find the model of their PC where the speed of the CD reader is 50x. 148. Show the model, ram and the hard disk size for all PCs. Order the results in descending order of the hard drive size. 149. Show the type and price for all printers, where price is greater than 200. 150. Find the price of the PCs which have less than 256MB of RAM. 151. List the details of each printer. 152. Find the different types of vehicles in the database. 153. Get plate numbers, makes and models of all cars imported from Japan. 154. Produce a list of all vehicles, showing only the plate numbers and the year of manufacture. Order the tuples by the year. 155. List the names of all owners. Sort the output by last name descending and by first name ascending. 156. Find the names of people who own more than one vehicle. 157. For each type of vehicle, show the plates numbers and the chassis numbers. 158. Find the color of the Daihatsu vehicles. 159. Show the details of all the employees who have been employed in registration organization 1303. 160. For each model of vehicle, show the country in which it has been registered and the total amount paid, if it is less than 300.00. 161. Find the name and IRD number of the Manager of registration organization 1352. 162. Show the ownerids and the date they have owned their vehicles. 163. Find the color of the vehicles with diesel motive power. 164. List full details of all suppliers. 165. Retrieve the name and address of the supplier whose id is 5. 166. List the name of the supplier and price for all suppliers who supply product 16. 167. Retrieve the name and address of all suppliers who supply triangle sanders. 168. Show the details of all the artists. 169. Show all the groups, in descending order. 170. Show the title of songs composed by Mary Jackson. 171. Show the ids of artists who play more than one instrument. 172. Find the names of the artists and instruments they played in 'Someone to watch over me' or 'Rainy night in Georgia'. 173. Find the ids of all artists who belong to more than one group. Show the number of groups for each artist. 174. Find how many CDs each group has released. 175. Find the title of the songs that are longer than 8 minutes. Sort the result in ascending order by titles. 176. Find the names of artists who belong to the 'Modern Jazz Quartet' group. 177. Find the catalog number of the CD titled 'Getz and Gilberto'. 178. For each year, show the number of CDs released that year. 179. Find manufacturers who make all types of printers. Do not enumerate the types of printers in your solution. 180. Find manufacturers who make only one type of printers and one type of computers. 181. Find the ids of books that have copies in all branches. 182. Find suppliers that do not offer any products over $150. 183. Find the names of all products supplied by Tools4U and no one else. 184. Find the name of the supplier who offers the lowest price for the rotary hammer. 185. Find products supplied by all suppliers except for 'No such supplier'. 186. Find the numbers of suppliers, which supply neither mini grinders nor paint tools. 187. Find the titles of the books that are kept in the Science (SCI) library only. 188. Find names of suppliers who do not supply any products for the catalog. 189. Find first and last names of those employees who work on all projects controlled by department 5. 190. Find how many employees work on more than two projects. 191. Find the type(s) of compositions that were composed in all eras in which symphonies were composed. 192. Find names of sponsors who have donated each year. 193. Find first and last names of people who own vehicles of all types. 194. Find the ids of artists who recorded every song on the CD titled 'The Distance to Here'. 195. Find the names of suppliers who supply all departments on floor 2. Descriptions of databases The COMPANY database contains information about a company. The company is organized into departments. Each department has a unique name, a unique number, and a particular employee who manages the department. We keep track of the start date when that employee began managing the department. A department may have several locations. A department controls a number of projects, each of which has a unique name, a unique number and a single location. We store each employee's name, IRD number, address, salary, sex, and birthdate. An employee is assigned to one department but may work on several projects, which are not necessarily controlled by the same department. We keep track of the number of hours per week that an employee works on each project. We also keep track of the direct supervisor of each employee. We want to keep track of the dependents of each employee for insurance purposes. We keep each dependent's name, sex, birthdate, and relationship to the employee. The MOVIES database contains information about a video club. Every movie has a unique number associated with it. Additional information about each movie include: the title of the movie, the year it was produced, the type of the movie, the critics rating (number of stars); the number of Academy Award nominations received and won. A movie is directed by one director only. Each director is represented by his/her name, unique number, year of birth and year of death (if appropriate). Movie stars are assigned unique numbers also. The star's name, birthplace, year of birth and year of death (if applicable) are known, as well as the role(s) the star played in various movies. Every customer has a unique number. Names and addresses of customers are stored in the database, as well as the number of rentals the customer has made, the number of bonus units the customer is entitled to (one for every 10 rentals) and the date of joining the club. There may be several copies of a movie in the video club. Every tape has its code (unique). It is known which movie a tape contains, when it was purchased, how many times it was rented and which customer currently has it (if appropriate). The REGISTRATION database stores data about vehicles, their owners and registration details. The following data is stored for each vehicle: make, model, plates, year of manufacture, engine number, chassis number, type (one of: p for private car, r for rental car, t for taxicab, l for truck and m for motorcycle), cc rating, data about first registration (i.e. date, distance recorder reading, status (one of new, used or rebuilt), country of previous registration in the case of imported vehicle, name of registration organisation, amount paid, name of the employee who registered the vehicle), number of passengers and/or capacity, motive power (p for petrol, g for gas and d for diesel), colour(s). Each owner of a car is described by his/her name, address, drivers licence number, phone, date of purchasing the vehicle, distance recorder reading at the time of purchase, IRD number, sex, birthdate and the employer (if applicable). The following information is stored about each registration of the vehicle: date, organisation, amount paid and the employee who registered the vehicle. There are several organisations which are licensed to register vehicles, known by their names, managers, addresses and employees. Each employee is known by his/her name, IRD number, starting date, sex, birthdate and office number." The MUSIC database contains information about composers and compositions they composed. For each composer, there is a unique number, lname, fname, country and year of birth, year of death (if known) and the name of the era they composed in. The only optional attribute is the year of death. For a composition, there is a unique number, title, nickname (the name the composition is known by, if any), type (e.g. opera, symphony) and composer's id. The PRODUCT database contains information about all the products being sold by a department store. The database stores data about various departments, products sold, and suppliers. The PRODUCT table stores information about each product. The Type attribute is a single letter code, one of B (book), C (clothes), E (equipment), F (furniture), T (toys) and R (recreational). The Colour attribute is optional. The SUPPLIER table stores information about suppliers. Information about deliveries is stored in the DELIVERY table. The same supplier may deliver goods to various departments. The DEPT table stores the name of each department, the floor it is located at, and the phone number. All attributes of this table are mandatory. The LIBRARY database contains information about various branches of the library, and about books the library holds. The BOOK table stores information about each book, and all its attributes are mandatory. The BOOKCOPIES table stores the number of copies of each book held in a specific branch of the library. The maximum number of copies of a book in the library is 20. The BRANCH table stores information about the branches: the id of the branch, its name and address. There are only three branches, and their ids are ENG for the Engineering branch, CEN for the Central branch, and SCI for the Science branch. Branch names and address must be known. The AUTHOR table stores information about the authors of each book." The COMPUTER-SHOP database contains information about a computer store. The PRODUCT table stores information about all the products sold in the shop. Each product has a unique model number, and the PRODUCT table also stores the manufacturer, type of the product (PC or printer) and price. The PC table gives for each model number the speed (in megahertz), the amount of RAM (in megabytes), the size of the hard disk (in gigabytes) and the speed of the CD reader (e.g., 32x). The PRINTER table records for each printer its model number, whether the printer produces colour output (true or false), and the type of the printer (laser, ink-jet or dry). The SPONSORS database contains information about sponsors for a humanitarian organization. The SPONSOR table contains data about sponsors: a unique number (there are less than 200 donors in the database), first name, last name, phone (4 digits only), state (exactly two characters), and city. The YEAR table stores information about the year and the goal for fund raising. The DONATION table stores information about the donations: the amount donated, year, and the id of the donor. The CD-COLLECTION database stores information about a CD collection. Each CD has a unique catalogue number, title, year of release, publisher, and the name of the group or the id of the artist that released the CD. A CD may contain many recordings. Each recording corresponds to one song, and there may be several different recordings of the same song on the same CD. A song is known by a unique id and its title. A recording involves several artists, and for each artist the instrument they played in that recording is known. Each artist has a unique id, and his/her name is stored. The IN_GROUP table stores information about various artists that perform together as a group. A song may be composed by one or more composers, and each composer has a unique id, and last and first name. Each recording has a unique id. The date of the recording and its duration are stored in the RECORDING table. The WOODWORK database stores information for a catalog of woodworking tools. The SUPPLIER table stores data about suppliers. Every supplier has an id (unique), name and address, and all three attributes of this table are mandatory. The PRODUCT table describes all tools available, by showing their numbers (unique), names (unique), and optionally colour. The CATALOG table lists the prices charged for products by suppliers. A product may be offered by several suppliers, with different prices. Feedback messages for level 4 (1 "The SELECT clause specifies attributes or expressions to be retrieved from the database. It is mandatory to specify the SELECT clause. The SELECT clause lists the attributes/expressions to be retrieved. A shorthand notation for retrieving all attributes of tables used is an asterisk (*). ") (2 "The FROM clause specifies the table(s) necessary in the query. It is mandatory to specify the FROM clause for all SELECT statements, including the nested ones. If there are two or more tables, you need to specify the join conditions. You may specify join conditions in the WHERE clause, but also in the FROM clause as well, as in the following example: FROM table1 JOIN table2 ON att1=att2, where att1 and att2 are the attributes that come from these two tables. You can also assign an alias to a table in the FROM clause, as in the following example: FROM a_table_with_a_very_long_name T The new name for the table is T, and you can use it in all other clauses of the query. ") (3 "The WHERE clause is used to specify conditions for data to satisfy in order to appear in the resulting table. Conditions are formed by comparing values of attributes to other attributes, or constants. Two types of conditions may appear. Join conditions specify how to combine information from two tables and are usually formed by using primary and foreign keys of tables involved. Search conditions restrict the tuples to be included in the result. The WHERE clause is an optional one; if it is omitted, all rows from the tables specified in the FROM clause qualify to be included in the result. ") (4 "String constants are defined in SQL as a sequence of characters between quotes. Make sure that you have quotes in all string constants you use. Note that quotes (') should be used, not back quotes (`).") (6 "SQL defines a set of words as keywords - special words that are used to specify requests on a database. WHERE is one such keyword, which denotes the beginning of a clause of the SELECT statement. The WHERE clause is used to specify conditions for data to satisfy in order to appear in the resulting table.") (7 "If query requests data that comes from more than one table (which are specified in the FROM clause of a SELECT statement), then it is necessary to join the tables. The JOIN keyword is used to specify the two tables to be joined. The format is: table1 JOIN table2 ON table1.attr1=table2.attr2, where table1.attr1 and table2.attr2 are the attributes on which tables are joined. The join attributes are usually primary and foreign keys of the corresponding tables. The order of attributes may be different from the order in which the tables are specified. Such join conditions may be specified in the FROM clause, or in the FROM clause of a nested query (in WHERE or HAVING clauses).") (8 "You have used several tables in this query. You need join conditions, that specify how the data from the tables is to be combined. A join condition compares the values of two attributes, coming from two tables. In most cases, if there are N tables in the query, then there should be N-1 join conditions.") (10 "Make sure that you have listed all the necessary tables for this query. Consider all the attributes necessary in join conditions, search conditions, expressions to be retrieved, grouping and restricting grouping, and sorting. ") (11 "Check whether the join conditions are needed in this query.") (12 "A join condition is an equality test on two attributes, coming from the two tables to be joined. The join attributes are usually the primary key of one table, and the corresponding foreign key in another table.") (13 "The NOT operator may be applied on a condition that has a truth value (such as a comparison or a predicate-defined condition). The condition must be enclosed in brackets. NOT cannot be applied on constants or attributes. NOT can appear only in WHERE or HAVING clauses.") (15 "String constants (i.e. sequences of characters enclosed in quotes) must be used as parts of comparisons. They cannot appear on their own in WHERE or HAVING clauses.") (16 "Read the text of the problem carefully, and make sure that you use the right comparison operator(s) in conditions.") (17 "Read the text of the problem carefully, and make sure that you use the right comparison operator when you compare an attribute to a constant in a negated condition.") (18 "You have put NOT in an incorrect place. Reconsider the syntax.") (19 "Aliases are temporary names assigned to expressions in the SELECT clause. The resulting tables will list aliases as column names. In order to define an alias, specify the keyword "AS" followed by the alias after the expression, and separate them with spaces. The AS keyword may only appear in the SELECT clause. ") (20 "Comparison operators can be used in conditions only. Conditions may be specified in WHERE or HAVING clauses.") (21 "The SELECT, FROM, WHERE, HAVING and GROUP BY keywords may appear in WHERE or HAVING clauses only, as parts of a nested query.") (22 "The ORDER keyword is used to start the ORDER BY clause, and may not be used anywhere else in a query.") (23 "The IS keyword can be used as a part of the IS [NOT] NULL predicate, which test whether the value of a particular attribute is (not) null. As all other conditions, this condition may be used in WHERE or HAVING clauses only. ") (24 "The IS [NOT] NULL predicate tests whether the value of a particular attribute is (not) equal to NULL. As all other conditions, this condition may be used in WHERE or HAVING clauses only. ") (25 "The IS [NOT] NULL predicate tests whether the value of a particular attribute is (not) equal to NULL. It does not make a sense to apply this predicate to an attribute which is defined with the NOT NULL option, because the value of such an attribute will never be NULL. The IS NULL predicate cannot be used instead of the equality operator. ") (26 "The IS [NOT] NULL predicate tests whether the value of a particular attribute is (not) equal to NULL. Read the text of the problem carefully, to see whether you need NOT.") (27 "The NULL keyword can be used as a part of the IS [NOT] NULL predicate only, which test whether the value of a particular attribute is (not) null. As all other conditions, this condition may be used in WHERE or HAVING clauses only. ") (28 "EXISTS, LIKE, BETWEEN, IN and ANY are predicates that may be applied on attributes in order to specify a condition for data to satisfy. As any other condition, such conditions are allowed in WHERE or HAVING clauses only.") (29 "The DISTINCT keyword is used to eliminate duplicates, and may only be used in the SELECT clause, or in the SELECT clause of a nested query (in WHERE or HAVING). DISTINCT should be specified in front of the corresponding attribute or expression. It does not make sense to use DISTINCT in front of *.") (30 "The ALL keyword is opposite from DISTINCT, and it requires all values of a certain attribute or an expression to be used to generate the result. ALL is the default keyword, and therefore is assumed even if it is not specified. ALL can be used in the SELECT or HAVING clauses, or in the SELECT clause of a nested query (in WHERE). ") (31 "The AND, OR and NOT keywords are reserved for Boolean operators used to combine conditions. A condition may only appear in the WHERE or HAVING clauses, and therefore these keywords are only allowed in these clauses.") (32 "Aggregate functions are functions that are applied on a set of values (e.g. the values of an entire column of a table). There are five aggregate functions in SQL: MIN, MAX, AVG, SUM and COUNT. The argument of an aggregate function may be any expression, enclosed in brackets. They can be used in SELECT, WHERE and HAVING clauses only. If they appear in the WHERE clause, then they must be a part of a nested query. ") (33 "The ASC (short for ascending) and DESC (descending) keywords are used to specify the sorting order in the ORDER BY clause. They cannot be used in any other clause of the SELECT statement. The default value is ASC, and it is assumed if there is no order specified. ") (34 "Semicolon is a special character in SQL which denotes the end of a statement. Therefore, it can only appear as the last character of a statement.") (35 "Read the text of the problem carefully and re-examine the sorting order you have specified.") (36 "If several attributes/expressions are used to sort the resulting tuples in the ORDER BY clause, their relative order is important. Read the text of the problem carefully, and determine which attribute/expression should go first.") (37 "When several tables are listed in the FROM clause, the syntax of SQL requires that their names be separated with commas. The only exception to this rule is when the join condition is specified in FROM.") (38 "When several attributes/expressions are listed, the syntax of SQL requires that their names be separated with commas.") (39 "Read the text of the problem carefully and check the condition specified with the LIKE predicate. The LIKE predicate is used to specify a pattern-matching search condition. The attribute used must be of type string, and it must be the first element of the condition, followed by an optional NOT keyword, and LIKE. After that, it is necessary to specify the pattern. A pattern is a string constant, and must be specified between quotes. The two special characters used in patterns are underscore (_), which matches any single character, and the percent sign (%), which matches zero or more characters. When specifying patterns, the case is important. Make sure that all the elements of your search condition are correct.") (40 "Attributes of type DATE must be compared to a string constant or another attribute/expression of the same type.") (41 "Numerical constants may be used in search conditions in WHERE and HAVING clauses, as components of comparisons, or conditions specified using the BETWEEN or IN predicates.") (42 "Read the text of the problem carefully, and think about the connectives (AND, OR, NOT) that are necessary to combine search conditions in WHERE.") (43 "Scalar functions are those functions that are applied on a single value from a table. Examples include functions for conversion from one data type to another, string functions, date functions etc. Scalar functions may be used in SELECT, WHERE or HAVING clauses.") (44 "The EXISTS predicate test whether a nested query retrieves any data or not. It may be negated (by putting the NOT keyword in front of it). The nested query must be enclosed in brackets.") (45 "The IN, EXISTS, ANY and ALL predicates are applied on a nested query that must be specified after the keyword, enclosed in brackets.") (47 "A subquery (or a nested query) is a SELECT statement embedded into a WHERE or HAVING clause. A subquery must be enclosed in brackets.") (48 "A subquery is used as one operand in a search condition. The necessary clauses for a subquery are SELECT and FROM. Very often, it is necessary to specify conditions for a subquery. However, there is no meaning in ordering the tuples retrieved by a subquery, as they are not going to be showed to the user, and therefore the ORDER BY clause is not allowed within a subquery.") (49 "The HAVING clause is used to eliminate some of the groups that have been defined by the GROUP BY clause, by specifying another condition that a group must satisfy in order to be included in the result. The HAVING clause requires the GROUP BY clause to be specified. ") (50 "If the query uses an attribute name that appears in several tables used, then the DBMS has problems resolving the references. It is necessary in such cases to qualify the attribute name with the table name (e.g. table1.attribute1).") (51 "The COUNT function returns the number of values it was given. Its argument may be a *, which means that the number of tuples would be returned, or an attribute name, possibly preceded by ALL or DISTINCT. If the COUNT function is used in a comparison, it must be compared to an integer constant.") (52 "The SUM and AVG functions return the sum and the average of values they were given, respectively. The argument must be a numerical expression/attribute.") (53 "Read the text of the problem carefully and consider whether you should use aggregate functions.") (54 "Read the text of the problem carefully and re-examine the argument(s) of aggregate function(s)!") (55 "The GROUP BY clause defines how to group the tuples of the resulting table. Grouping is very useful if you want to calculate some summary information, such as the sum of the values of an attribute and similar. The GROUP BY clause should contain all the attributes listed in the SELECT clause (excluding aggregate functions).") (56 "The problem asks for the resulting table to be sorted. You can sort the tuples using the ORDER BY clause. You should list the attributes whose values are used to sort the resulting tuples. There are two possible orderings: descending (specified by the DESC keyword) and ascending (using the ASC keyword). The latter is the default option. You may list several attributes in the ORDER BY clause, but they should be separated with a comma." ) (57 "Check whether you need the GROUP BY clause or not. The GROUP BY clause defines how to group the tuples of the resulting table. Grouping is very useful if you want to calculate some summary information, such as the sum of the values of an attribute and similar.") (58 "The MIN and MAX aggregate function return the smallest and biggest value of all the values that they were given, respectfully. If they are used in a comparison, the type of constant they are compared to must be the same as the type of the argument of the aggregate function.") (59 "The BETWEEN predicate is used to test whether the value of an attribute, whose name is given before the keyword, belongs to an interval determined by the lower bound and an upper bound, which are specified after the keyword and separated by the keyword AND. The type of the lower and upper bound must be the same as the type of the attribute given. A condition specified with the BETWEEN predicate may be negated, by putting NOT before BETWEEN.") (60 "Read the text of the problem carefully and make sure that you have defined all the necessary search conditions! Check that the conditions you have defined are syntactically correct!") (61 "Read the text of the problem carefully and make sure that you have defined all the necessary HAVING conditions!") (62 "Read the text of the problem carefully and make sure that you use appropriate constants in conditions!") (63 "Read the text of the problem carefully and make sure that all the search conditions you have defined in the WHERE clause are necessary!") (64 "Read the text of the problem carefully and make sure that all the HAVING conditions you have defined are necessary!") (65 "The IN predicate compares the value of an attribute, whose name must come before the keyword, to a set of values of the same type as the type of the attribute, which are listed between brackets and are separated by commas. The IN predicate may also compare the value of an attribute to the values retrieved by a nested SELECT, which comes after the keyword.") (66 "An aggregate function may be applied on the whole table, or on each group defined by the GROUP BY clause. In the former case, the only type of expressions allowed in the SELECT clause is aggregate function calls.") (67 "Arithmetic expressions are formed by using arithmetic operations (+,-,*,//) and combining them with attribute names, functions and constants. All attributes and constants used must be numerical ones. Arithmetic expressions may be used in the SELECT, WHERE and HAVING clauses. Read the text of the problem and make sure your expressions are correct.") (68 "Numeric functions may be applied on numerical attributes. Their arguments must be enclosed in brackets. Examples of numeric functions are ABS, SIN, COS, ATAN, EXP, and LOG.") (69 "Read the text of the problem carefully and check whether you have specified all the attributes that are needed or not. Make sure that you list only the necessary attributes/expressions.") (70 "The ANY and ALL predicates are used to compare a value of an attribute (specified before the keyword) to a list of values retrieved by a nested SELECT. The attribute must be of the same type as the values retrieved by the subquery. The SELECT clause of the nested query must contain only one expression.") (71 "The SELECT clause of the nested query must contain attributes that come from the tables specified in the nested query!") (72 "Names allowed in SQL are sequences of character not longer than 24 characters.") (73 "All names used in a query must be tables names from the tables of the current database, or attribute names from tables which have been used in the query.") (74 "Check the qualified attributes names involving aliases for tables. Make sure that the attributes do come from the tables whose aliases you use!") (75 "Avoid using unnecessary tables. If more tables are used, queries become inefficient. Make sure that you really need all the tables you specified in the query. If you need a table, then you have to use its attributes.") (76 "In comparisons, the type of an attribute used must be the same as the type of the constant.") (77 "Make sure that you compare constants to right attributes!") (78 "If a nested query is used in a comparison, its SELECT clause must contain only a single expression.") (79 "Read the text of the problem carefully and check whether you need arithmetic expressions!") (80 "SQL supports INNER join, and three types of OUTER join: LEFT, RIGHT and FULL. The INNER join is the default option. In the case of an outer join, it is necessary to specify the type before the JOIN keyword. The outer join keeps all tuples from the left table (in the case of the LEFT join), right table (for RIGHT join) and both tables (FULL), rather than just the matching tuples, as in the case of the INNER join.") (81 "The comparison predicates allowed in SQL are: <, >, =, <>, !=, <= and >=. In the case of a predicate consisting of two signs, a space is not allowed in between.") (82 "When specifying grouping in a nested select, it is necessary to use both keywords (GROUP and BY).") (83 "DATE is a reserved word in SQL. DATE is a function which takes a single argument, which must be a string, and turns it into a date.") (84 "An SQL string pattern is a string containing two additional characters: the underscore replaces a single character, and the percent sign replaces zero or more characters. A pattern must be used in a condition specified with the LIKE predicate.") (85 "Read the text of the problem carefully, and check the lower and the upper value you have specified for BETWEEN in the WHERE clause!") (86 "Read the text of the problem carefully, and check the lower and the upper value you have specified for BETWEEN in the HAVING clause!") (87 "The AND, OR and NOT keywords are reserved for Boolean operators used to combine conditions. Make sure that you are using the correct one in WHERE.") (88 "The AND, OR and NOT keywords are reserved for Boolean operators used to combine conditions. Make sure that you are using the correct one in HAVING.") (89 "When comparing the value of an aggregate function in HAVING, the nested SELECT statement must have the same aggregate function in its SELECT clause.") (90 "There must be an open bracket and a closed bracket in a clause.") (91 "Check the qualified attribute which use aliases for table names. Make sure that the alias is defined in the FROM clause, or in the nested query.") (92 "You have used two tables with the same name in FROM. You need to define aliases for them. Aliases are temporary names to be used for tables within the query. Since you have two copies of the same table, you need to assign two different aliases to them.") (93 "You have used two copies of the same table in FROM, and assigned aliases to them. The same aliases should be used to qualify attribute names used in the join condition.") Feedback messages for level 3 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. The SELECT clause is a mandatory one. Specify the attributes/expressions to retrieve from the database. The FROM clause is a mandatory one. Specify the tables to retrieve data from. Check the position of a semicolon in FROM! You have a semicolon in FROM! Do you need the other clause(s)? Check the position of a semicolon in WHERE! Check the position of a semicolon in GROUP BY! Check the position of a semicolon in HAVING! Check the position of a semicolon in ORDER BY! You have a semicolon in WHERE! Do you need the later clause(s)? You have a semicolon in GROUP BY! Do you need the later clause(s)? You have a semicolon in HAVING! Do you need the ORDER BY clause? You have not terminated the string(s) in WHERE with an apostrophe! You have not terminated the string(s) in SELECT with an apostrophe! You have used the backquote character (`) in SELECT. If you want to specify a constant, use a quote instead ('). You have used the backquote character (`) in FROM. If you want to specify a constant, use a quote instead ('). Remember, constants cannot be used in FROM! You have used the backquote character (`) in WHERE. If you want to specify a constant, use a quote instead ('). You have used the backquote character (`) in GROUP BY. If you wanted to specify a constant, you should have used a quote instead ('). Remember, constants cannot be used in GROUP BY! You have used the backquote character (`) in HAVING. If you want to specify a constant, use a quote instead ('). You have used the backquote character (`) in ORDER BY. If you wanted to specify a constant, you should have used a quote instead ('). Remember, constants cannot be used in ORDER BY!" You have used an incorrect comparison predicate in WHERE. Lessthan-or-equal is written in SQL as <= You have used an incorrect comparison predicate in HAVING. Lessthan-or-equal is written in SQL as <= 22. You have used an incorrect comparison predicate in WHERE. Greater-than-or-equal is written in SQL as >= 23. You have used an incorrect comparison predicate in HAVING. Greater-than-or-equal is written in SQL as >=" 24. You have specified a comparison predicate incorrectly in WHERE; no spaces are allowed in predicates. 25. You have specified a comparison predicate incorrectly in HAVING; no spaces are allowed in predicates. 26. The WHERE keyword can appear in the WHERE clause only as a part of a nested SELECT. 27. You have ended the SELECT clause with a comma - that is not allowed. 28. You have ended the GROUP BY clause with a comma - that is not allowed. 29. You have ended the ORDER BY clause with a comma - that is not allowed. 30. You have ended the FROM clause with a comma - that is not allowed. 31. You have ended the WHERE clause with a comma - that is not allowed. 32. You have ended the HAVING clause with a comma - that is not allowed. 33. Check your brackets! You have a ) without a (! 34. Check your brackets! You have a ) without a (! 35. If the JOIN keyword is used in the FROM clause, the same clause should contain a join condition specified on a pair of attributes from corresponding tables being joined. 36. If the JOIN keyword is used in the FROM clause, the same clause should contain a join condition specified on a pair of attributes from corresponding tables being joined. 37. You need the JOIN keyword in FROM! 38. Check the syntax for the JOIN and ON keywords in FROM! 39. You need the ON Keyword in FROM! 40. All the names in the FROM clause must be table names except if there is a join condition specified in FROM. 41. The SELECT, FROM and WHERE keywords cannot be used in the SELECT clause - they may only appear in WHERE or HAVING clauses, in a nested query. 42. The SELECT, FROM and WHERE keywords cannot be used in the FROM clause - they may only appear in WHERE or HAVING clauses, in a nested query. 43. The SELECT, FROM and WHERE keywords cannot be used in the GROUP BY clause - they may only appear in WHERE or HAVING clauses, in a nested query. 44. The SELECT, FROM and WHERE keywords cannot be used in the ORDER BY clause - they may only appear in WHERE or HAVING clauses, in a nested query. 45. MIN, MAX, AVG, COUNT or SUM functions may appear in the WHERE clause only in a nested SELECT statement. 46. There should be a comma between every two table names in the FROM clause. 47. All names in the SELECT clause must be attribute names from the tables listed in the FROM clause. 48. You do not have all the tables that are needed in the FROM clause! 49. You do not need all the tables you used in FROM! 50. You have to use another table in this query! 51. You do not need all the tables you used in this query! 52. You have to use another table in this query! 53. You do not need all the tables you used in this query! 54. Check the name of the aggregate function(s) you use in SELECT! 55. Check the name of the aggregate function(s) you use in WHERE! 56. Scalar functions (numeric, date or string ones) cannot be used in the FROM clause --- they may only appear in WHERE, HAVING and SELECT. 57. Scalar functions (numeric, date or string ones) cannot be used in the GROUP BY clause --- they may only appear in WHERE, HAVING and SELECT. 58. Scalar functions (numeric, date or string ones) cannot be used in the ORDER BY clause --- they may only appear in WHERE, HAVING and SELECT. 59. Check how you use DATE in SELECT! 60. Check how you use DATE in WHERE! 61. Check how you use DATE in HAVING! 62. You do not need to specify the join condition(s)! 63. You do not need to specify the join condition(s)! 64. You need the JOIN keyword in FROM! 65. Check whether you have specified all the necessary join conditions. 66. Check whether you have specified all the necessary join conditions. 67. Check whether you have specified all the necessary join conditions. 68. You have to specify the join condition between the table(s) in FROM and table(s) in the nested SELECT! 69. You have to specify the join condition between the table(s) in FROM and table(s) in the nested SELECT! 70. You have to specify the join condition between the table(s) in FROM and table(s) in the nested SELECTs! 71. Check that you use the right attributes in the join condition in the nested SELECT statement! 72. Check that you use the right attributes in the join condition in the nested SELECT statement! 73. You have used the NOT operator incorrectly in WHERE - it can be applied on conditions only! 74. You have used the NOT operator incorrectly in HAVING - it can be applied on conditions only! 75. The expression NOT is applied on must be enclosed in brackets in WHERE. 76. The expression NOT is applied on must be enclosed in brackets in HAVING. 77. You need to specify an attribute to compare the string constant to in WHERE! 78. You need to specify an attribute to compare the string constant to in HAVING! 79. Check the comparison operator you use in WHERE! 80. Check the comparison operator you use in HAVING! 81. Check the comparison operator you use in WHERE! 82. Check the comparison operator you use in HAVING! 83. Check the comparison operator you use in WHERE! 84. Check the comparison operator you use in HAVING! 85. Check the comparison operator you use in WHERE! 86. Check the comparison operator you use in HAVING! 87. Check the comparison operator you use in WHERE! 88. Check the comparison operator you use in HAVING! 89. Check the comparison operator you use in WHERE! 90. Check the comparison operator you use in HAVING! 91. Check the comparison operator you are using when comparing a constant to an attribute in the negated condition in WHERE! 92. Check the comparison operator you are using when comparing a constant to an attribute in the negated condition in HAVING! 93. Check the comparison operator you are using when comparing a constant to an attribute in the negated condition in WHERE!" 94. Check the comparison operator you are using when comparing a constant to an attribute in the negated condition in HAVING! 95. Make sure NOT is in the right place in WHERE! 96. The nested SELECT requires the FROM clause as well! 97. Comparison predicates (=,<>,>,<,>=,<=) cannot be used in the SELECT clause --- they can appear in WHERE or HAVING clauses only. 98. Comparison predicates (<>,>,<,>=,<=) cannot be used in the FROM clause --- they can appear in WHERE or HAVING clauses only. 99. Comparison predicates (=,<>,>,<,>=,<=) cannot be used in the ORDER BY clause --- they can appear in WHERE or HAVING clauses only. 100. Comparison predicates (=,<>,>,<,>=,<=) cannot be used in the GROUP BY clause --- they can appear in WHERE or HAVING clauses only. 101. The ORDER keyword cannot appear in the SELECT clause. 102. The ORDER keyword cannot appear in the FROM clause. 103. The ORDER keyword cannot appear in the WHERE clause. " 104. The ORDER keyword cannot appear in the GROUP BY clause. 105. The ORDER keyword cannot appear in the ORDER BY clause. 106. The ORDER keyword cannot appear in the HAVING clause. 107. The GROUP, BY and HAVING keywords cannot be used in the SELECT clause. 108. The GROUP, BY and HAVING keywords cannot be used in the FROM clause. 109. The GROUP, BY and HAVING keywords cannot be used in the GROUP BY clause. 110. The GROUP, BY and HAVING keywords cannot be used in the ORDER BY clause. 111. The GROUP, BY and HAVING keywords can appear in the WHERE clause only as a part of a nested query. 112. The GROUP, BY and HAVING keywords can appear in the HAVING clause only as a part of a nested query. 113. The NULL keyword cannot be used in the SELECT clause - it may only appear in WHERE or HAVING clauses. 114. The NULL keyword cannot be used in the FROM clause - it may only appear in WHERE or HAVING clauses. 115. The NULL keyword cannot be used in the GROUP BY clause - it may only appear in WHERE or HAVING clauses. 116. The NULL keyword cannot be used in the ORDER BY clause - it may only appear in WHERE or HAVING clauses. 117. The IS keyword cannot be used in the SELECT clause --- it may only appear in WHERE or HAVING clauses. 118. The IS keyword cannot be used in the FROM clause --- it may only appear in WHERE or HAVING clauses. 119. The IS keyword cannot be used in the GROUP BY clause --- it may only appear in WHERE or HAVING clauses. 120. The IS keyword cannot be used in the ORDER BY clause --- it may only appear in WHERE or HAVING clauses. 121. The IS NULL predicate cannot be used in the SELECT clause --- it may only appear in WHERE or HAVING clauses. 122. The IS NULL predicate cannot be used in the FROM clause --- it may only appear in WHERE or HAVING clauses. 123. The IS NULL predicate cannot be used in the GROUP BY clause --it may only appear in WHERE or HAVING clauses. 124. The IS NULL predicate cannot be used in the ORDER BY clause --it may only appear in WHERE or HAVING clauses. 125. If the IS NULL operator is used in a condition, then the attribute in question should not be a required one (defined with a NOT NULL option). 126. If the IS NULL operator is used in a condition, then the attribute in question should not be a required one (defined with a NOT NULL option). 127. Check whether you need NOT in the IS NULL predicate! 128. The NULL keyword should be preceded by IS, possibly separated by a NOT. 129. You need to specify a search condition using the IS NULL predicate! 130. The EXISTS, LIKE, BETWEEN, IN and ANY predicates cannot be used in the SELECT clause --- they may only appear in the WHERE or HAVING clauses. 131. Check how you use the string pattern in WHERE! 132. The ON and JOIN keywords cannot be used in the SELECT clause. They may only appear in the FROM clause, and also in WHERE or HAVING clauses in a nested subquery. 133. The DISTINCT keyword cannot be used in the FROM clause. It may only appear in the SELECT clause, and also in WHERE or HAVING clauses in a nested subquery. 134. The ALL keyword cannot be used in the GROUP BY clause --- it may only appear in SELECT, WHERE or HAVING clauses 135. Check whether you should have ascending or descending order in the ORDER BY clause! 136. Check whether you should have ascending or descending order in the ORDER BY clause! 137. Check the order of attributes you specified for sorting the resulting tuples in the ORDER BY clause! 138. Check whether you have specified all the necessary attributes in the ORDER BY clause! 139. The attributes used in the ORDER BY clause should be separated by commas. 140. There should be a comma between every two expressions in the SELECT clause. 141. The attributes in the GROUP BY clause should be separated by commas. 142. If the LIKE operator is used in a search condition, then the attribute should be of the type string, the constant used for comparison must also be a string constant. Special characters allowed are underscore and percent sign. 143. If a DATE type attribute is used in a condition, it must be compared to a string or an attribute of the same type. 144. You have used a numeric constant in WHERE incorrectly. A numeric constant may be used with IN or BETWEEN predicates, or in a comparison. 145. Check that you use logical connectives (AND, OR) between conditions in the WHERE clause! 146. Check whether you have specified the search condition after AND/OR in the WHERE clause correctly! 147. Check that you use logical connectives (AND, OR) between conditions in the WHERE clause! 148. Check that you use logical connectives (AND, OR) between conditions in the WHERE clause! 149. Check whether you have specified the search condition after AND/OR in the WHERE clause correctly! 150. Check that you use logical connectives (AND, OR) between conditions in the WHERE clause! 151. Check whether you have specified the search condition after AND/OR in the WHERE clause correctly! 152. Check whether/how you use logical connectives (AND, OR) between conditions in the WHERE clause! 153. The ON or JOIN keywords which appear in the WHERE clause must be parts of the FROM clause of a subquery. 154. The ON or JOIN keyword which appear in the HAVING clause must be parts of the FROM clause of a subquery. 155. The DISTINCT keyword which appears in the WHERE clause must be a part of the SELECT clause of a subquery. 156. If the DISTINCT keyword is specified within COUNT, there must also be an attribute specified after it. 157. If there is an EXISTS predicate in the WHERE clause, then it should be followed by a nested SELECT statement. 158. If the IN, EXISTS, ANY or ALL operators are used in a search condition, then the corresponding condition must be specified within brackets. 159. If the IN, EXISTS, ANY or ALL operators are used in a search condition, then the corresponding condition must be specified within brackets. 160. When using the IN predicate in WHERE, you have to specify the attributes name! 161. The NOT keyword can be followed by LIKE, NULL, EXISTS, IN, BETWEEN OR (. 162. The NOT keyword can be followed by LIKE, NULL, EXISTS, IN, BETWEEN OR (. 163. A subquery in the WHERE clause must be enclosed within brackets. 164. A subquery in the HAVING clause must contain a FROM clause. 165. A subquery in the WHERE clause must be enclosed within brackets. 166. You are missing the BY keyword after GROUP in the nested SELECT statement in WHERE. 167. You need to define the GROUP BY clause for the nested SELECT in WHERE! 168. A subquery in the WHERE clause cannot contain an ORDER BY clause. 169. A subquery in the HAVING clause cannot contain an ORDER BY clause. 170. MIN, MAX, AVG, COUNT or SUM functions may appear in the WHERE clause only in a nested SELECT statement. 171. A subquery must contain at least SELECT and FROM clauses. 172. A subquery must be preceded with a comparison operator, IN, ANY, ALL, or EXISTS predicates. 173. You have to specify the grouping in the GROUP BY clause before you can specify how to restrict grouping in the HAVING clause! 174. You have used an attribute in the SELECT clause which appears in several tables you specified in the FROM clause. Qualify the attribute name with the table name to eliminate ambiguities. 175. You have used an attribute in the WHERE clause which appears in several tables you specified in the FROM clause. Qualify the attribute name with the table name to eliminate ambiguities 176. MIN, MAX, AVG and SUM functions take a single argument which must be an attribute or an arithmetic expression 177. Check whether you should have the COUNT function in SELECT! 178. Check the integer constant you used with the aggregate function in HAVING! 179. Check the integer constant you used with the aggregate function in HAVING. 180. Check the operator you used with the aggregate function in HAVING! 181. You need to specify the GROUP BY clause as well! 182. You need to restrict grouping --- specify the HAVING clause as well! 183. You do not need the GROUP BY clause! 184. The COUNT function in the HAVING clause must be compared to an integer constant or to the value returned by a nested SELECT! 185. When using functions MIN or MAX in the HAVING clause, you need a constant in the comparison which must be of the same type as the type of the attribute. 186. If the BETWEEN operator is used in a search condition, there must be an attribute whose value is being compared before BETWEEN. 187. Check the constant(s) you are using in the BETWEEN predicate in WHERE! 188. Check that you have used the correct operators to represent a range of values in WHERE! 189. Check the constant you use in WHERE when you check whether the attribute is greater-than-or-equal to a number. 190. Check the constant you use in HAVING when you check whether the attribute is less-than-or-equal to a number! 191. Check the lower constant you use in BETWEEN in HAVING! 192. All the names used as attributes names in the WHERE clause must be attribute names from the tables named in the FROM clause except for names in nested SELECTs. 193. You have used a qualified attribute name in the SELECT clause, and the same table name or alias should appear in the FROM clause and the attribute should appear in that table. 194. For every table that appears in the FROM clause, there must be at least one attribute from that table used in any clause of the query. 195. Check that you are comparing the string constant to the right attribute in the WHERE condition! 196. If a subquery is used as one operand in a comparison in the WHERE clause, then its SELECT clause must contain only one expression. 197. Check the string constants you are using in WHERE. Unless you use the right case for string constants, you would not be able to retrieve the data you need! 198. Check the attributes you are using in FROM to join the tables! 199. You do not need the WHERE clause! 200. Check the comparison operator you are using in the WHERE clause to compare the value of the attribute to an integer! 201. What kind of JOIN is needed in this problem? 202. Make sure you are using the right kind of JOIN! 203. Make sure you are joining the right tables! 204. Check whether you need left or right outer join! 205. Check whether you need left or right outer join! 206. You have used a numeric constant in WHERE incorrectly. 207. The constant must be compared to an attribute, which is missing. 208. You have used a numeric constant in WHERE incorrectly. The constant must be compared to an attribute, or a nested query, which is missing. 209. You have used a numeric constant in HAVING incorrectly. The constant must be compared to an aggregate function, nested query or an attribute, which is missing. 210. Check whether you should have NOT in front of EXISTS! 211. Check whether you should have NOT in front of EXISTS! You need to specify another condition using NOT EXISTS!