Library Database Sql Query Examples – Query Examples

Library Database Sql Query Examples

Library Database Sql Query Examples

This article is written for library database sql queries. There are 30 query examples in this article. In the future I will add more queries. Follow me…

TO DOWNLOAD THE SAMPLE LİBRARY DATABASE CLICK

YOU MAY WANT TO SEE OUR ALL EXAMPLES PAGE, THEN CLICK HERE

Simple Sql Query Examples

Example 1: List the books where page count bigger than 200

Result Of The Query

Listed 96 rows

Example 2: List the books where pageCount is between 100 and 200

Result Of The Query

Listed 61 rows

Example 3: List the boys from 11a or 11b

Result Of The Query

Listed 25 rows

Example 4: List the book which have biggest page count

Solution-2

Result Of The Query

Example 5: List all students class names,but the same class names are listed ones.

Result Of The Query

Listed 20 rows

Group by Statement Examples

Example 6: List the class names and student count of each class.

Group by Statement Examples

Example 6: List the class names and student count of each class.

Result Of The Query


Listed 20 rows

Example 7: List the numbers of boys and girls in each class.

Result Of The Query

Listed 40 rows

Example 8: List only the number of female students in each class.

Result Of The Query

Listed 20 rows

Example 9: List the class names and number of students which the number of students more than 30.

Result Of The Query

Listed 2 rows

Sql Complex Query Examples

Example 10: List all students name, surname, the name of the taken book,the taken date and the book’s type

Result Of The Query

6308 rows

Example 11: List all students name, surname, the name of the taken book, the taken date, the book’s type and the name and surname of the author

Result Of The Query

6308 rows

Example 12: List the students name, surname, the name of the taken book and the taken time from 11B class

Result Of The Query

276 rows

Example 13: List the name and surname of the students and the number of books they read.

Result Of The Query

504 rows

Example 14: List the name and surname of the students and the number of books they read sorted by BookCount.

Result Of The Query

504 rows

Example 15:  Lists students who have not read books.

Result Of The Query

Example 16: List the books, that the student named John has read. The same records are listed ones.

Result Of The Query


Listed 167 rows

Example 17: List the author that has the most books.

Result Of The Query

Example 18: List all student’s name,surname and the borrow’s taken date.

Result Of The Query

Example 18: List all student’s name,surname and the borrow’s taken date.

Result Of The Query

Example 19: List all student’s name,surname,book’s name and the borrow’s taken date.(three table)

Result Of The Query

Example 20: List all student’s name,surname and the borrow’s taken date. Students who do not read books are also listed.

Result Of The Query

SQL SUBQUERY EXAMPLES

Example 21: List the book with the most page number

Result Of The Query

Example 22: List students who have not read books.

Result Of The Query

Example 23: Delete students who do not read books.

Result Of The Query: 1 row(s) efected

Example 24: List the name and surname of the students and the number of books they read sorted by BookCount. Also list the students who have never read a book.

Result Of The Query

SQL INSERT STATEMENT EXAMPLES

Example 25: Add the writer named Zane Grey to the authors table

Result: 1 row(s) effected

Example 26: Add the student named Ace Collins to the students table

Result: 1 row(s) effected

Example 27: Add all authors to the students table

Result: 110 row(s) effected

Example 28: Add the writers named Ernest Dowson and Mother Goose to the authors table

Result: 2 row(s) effected

Example 29: Insert into the authors table, Random selected five students

Result: 5 row(s) effected

YOU MAY WANT TO SEE OUR ALL EXAMPLES PAGE, THEN CLICK HERE

About the author

admin

1 Comment

  • I appreciate your rendering these details for individuals seeking to get
    more information on issues similar to this. Your blog was well written and very
    well investigated, and that is very much appreciated.
    I am generally looking for new sites to follow and read regularly.

Leave a Comment

%d bloggers like this: