The following SQL codes are used to select personal information that is inquired. The student ID and the inquired time of participation are typed in by users. The information of time, total score and score of each type of sport earned by the student during the month is returned.

All the information is selected from a view called indv_cmpr_view.

Version 1

Version 2

The design of SQL sentence greatly affects the efficiency of query. Although the two versions of SQL sentences return the same results, the second one may be more efficient.

There are approximately 300 students in our department, who are the users of our product so far. There may be nearly 3000 tuples in the indv_cmpr_view right now, assuming every student has ten record of participation on average. To simplify the analysis, we assume that there are 1200 tuples for year 2011 and 100 tuples for December. If the first version is used and sid = 2009010857, year = 2011, month = 12 are typed in, 3000*1200*100*10 = 3600000000 inspections on average. In version two is used, 3000*10= 30000 inspections are needed before searching for the year and month. The following searching will be down in a scope of 10 tuples on average. Obviously, the second version will be much faster than the first one in efficiency.

 

Views: 10

Comment

You need to be a member of Toyhouse to add comments!

Join Toyhouse

CC Creative Commons

Share your knowledge and creativity with the world, protect your work with CC Licenses and discover other creative works and CC activities around the world. For Chinese CC, please go to: (中文版知识共享协议网站请点击http://cn.creativecommons.org.

 

 

Creative Commons licenses provide a flexible range of protections and freedoms for authors, artists, and educators.

Members

Birthdays

Birthdays Tomorrow

Photos

Loading…
  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

Sponsors

© 2012   Created by Toyhouse Administrator.

Badges  |  Report an Issue  |  Terms of Service