News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

Advertisement

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;

Books

------

BookId

BookName

AuthorId

SubjectId

PopularityRating       (the popularity of the book on a scale of 1 to 10)

Language               (such as French, English, German etc)

Subjects

---------

SubjectId

Subject   (such as History, Geography, Mathematics etc)

Authors

--------

AuthorId

AuthorName

Country

What is the query to determine the names of the Authors who have written more than 1 book?

  1. select AuthorName from Authors where AuthorId in

         (select AuthorId from Books group by AuthorId having count(*)>1)

  2. select AuthorName from Authors, Books

         where Authors.AuthorId=Books.AuthorId and count(BookId)>1

  3. select AuthorName from Authors, Books

         where Authors.AuthorId=Books.AuthorId

         group by AuthorName having count(*)>1

  4. select AuthorName from Authors where AuthorId in

         (select AuthorId from Books having count(BookId)>1)

Answer: Answer is a, c
Further Reading:

Useful resources, GROUP BY,SQL basic queries, query fundamental, HAVING Clause, COUNT, SQL IN

comments powered by Disqus
Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;