The Queries in this page solved at the library database. It is a sample database generated by randomly records. You can download it from the link. You will see more than 500 examples in the future. You can filter from the search panel above by selecting sql statements. I hope you will like it
Solution 1)
Select top 1 * from books
order by sayfaSayisi desc
Solution 2)
Select * from books
where sayafaSayisi=(Select max(sayfaSayisi) from books)
ETİKETLER
Select - Top - Where - Order By - Sub Query - Aggragate -Solution 1)
Select count(*) from books
Solution 2)
Select count(bookId) from books
ETİKETLER
Select - Aggragate -Solution 1)
Select count(*) from students
Solution 2)
Select count(studentId) from students
ETİKETLER
Select - Aggragate -Solution 1)
Select sum(pageCount) from books
ETİKETLER
Select - Aggragate -Solution 1)
Select sum(point) from students
ETİKETLER
Select - Aggragate -Solution 1)
Select avg(point) from students
ETİKETLER
Select - Aggragate -Solution 1)
Select min(pageCount) from books
ETİKETLER
Select - Aggragate -Solution 1)
Select max(point) from books
ETİKETLER
Select - Aggragate -Solution 1)
Select avg(pageCount) from books
ETİKETLER
Select - Aggragate -Solution 1)
Select count(*) from students
where sinif = '9B'
ETİKETLER
Select - Where - Aggragate -Solution 1)
Select sum(pageCount) from books
join types on types.typeId = books.typeId
where types.name = 'Romance'
ETİKETLER
Select - Join - Where - Aggragate - Çoklu Tablo -Solution 1)
Select count(*) from books
join types on types.typeId = books.typeId
where types.name = 'Horror'
ETİKETLER
Select - Join - Where - Aggragate - Çoklu Tablo -Solution 1)
Select avg(pageCount) from books
join types on types.typeId = books.typeId
where types.name = 'Comics'
ETİKETLER
Select - Join - Where - Aggragate - Çoklu Tablo -Solution 1)
Select sum(pageCount) from books
join authors on authors.authorId = books.authorId
where authors.name = 'John' and authors.surname = 'DosPassos'
ETİKETLER
Select - Join - Where - Aggragate - Çoklu Tablo -Solution 1)
Select sum(point) from books
join authors on authors.authorId = books.authorId
where authors.name = 'Emily' and authors.surname = 'Dickinson'
ETİKETLER
Select - Join - Where - Multi Condition - Aggragate - Çoklu Tablo -Solution 1)
Select count(*) from books
join authors on authors.authorId = books.authorId
where authors.name = 'Edna' and authors.surname = 'Ferber'
ETİKETLER
Select - Join - Where - Multi Condition - Aggragate - Çoklu Tablo -Solution 1)
Select count(*) from students
join borrows on students.studentId = borrows.studentId
where students.name = 'Alice' and students.surname = 'Wood'
ETİKETLER
Select - Join - Where - Multi Condition - Aggragate - Çoklu Tablo -Solution 1)
Select sum(pageCount) from students
join borrows on students.studentId = borrows.studentId
join books on books.bookId = borrows.bookId
where students.name = 'Ainsley' and students.surname = 'Cooper'
ETİKETLER
Select - Join - Where - Multi Condition - Aggragate - Çoklu Tablo -Solution 1)
Select count(distinct authorId) from students
join borrows on students.studentId = borrows.studentId
join books on books.bookId = borrows.bookId
where students.name = 'Ida' and students.surname = 'Gray'
ETİKETLER
Select - Distinct - Join - Where - Multi Condition - Aggragate - Çoklu Tablo -Solution 1)
Select sinif,count(*) as StudentCount
from students
group by sinif
ETİKETLER
Select - Group By - Aggragate -Solution 1)
Select gender,count(*) as StudentCount
from students
group by gender
ETİKETLER
Select - Group By - Aggragate - Alias -Solution 1)
Select sinif,gender,count(*) as StudentCount
from students
group by gender,sinif
ETİKETLER
Select - Group By - Aggragate - Alias -Solution 1)
Select sinif,gender,count(*) as StudentCount
from students
where gender = 'F'
group by gender,sinif
ETİKETLER
Select - Where - Group By - Aggragate - Alias -Solution 1)
Select name,surname,count(*) BookCount
from students,borrows
where students.studentId = borrows.studentId
group by students.studentId,name,surname
Solution 2)
Select name,surname,count(*) BookCount
from students
join borrows on students.studentId = borrows.studentId
group by students.studentId,name,surname
ETİKETLER
Select - Join - Where - Group By - Aggragate - Alias - Çoklu Tablo -Solution 1)
Select name,surname,count(*) BookCount
from students
join borrows on students.studentId = borrows.studentId
group by students.studentId,name,surname
order by BookCount desc
Solution 2)
Select name,surname,count(*) BookCount
from students,borrows
where students.studentId = borrows.studentId
group by students.studentId,name,surname
order by BookCount desc
ETİKETLER
Select - Join - Where - Group By - Order By - Aggragate - Alias - Çoklu Tablo -Solution 1)
Update books set point +=10
where pagecount = (Select MAX(pagecount) from books)
ETİKETLER
Update - Where - Sub Query - Aggragate -