logo

Structured Query Language (SQL)

7 Pages1547 Words119 Views
   

Added on  2023-06-10

About This Document

This article discusses SQL statements for book publishers, authors, and sales. It explains the rationale behind each query and reflects on the process of writing SQL statements. The article also includes a bibliography of related research.

Structured Query Language (SQL)

   Added on 2023-06-10

ShareRelated Documents
Running head: STRUCTURED QUERY LANGUAGE (SQL)
Structured Query Language (SQL)
Name of the Student
Name of the University
Structured Query Language (SQL)_1
1STRUCTURED QUERY LANGUAGE (SQL)
Table of Contents
SQL Statements:..............................................................................................................................2
Rationale:.........................................................................................................................................4
Reflection:........................................................................................................................................4
Bibliography:...................................................................................................................................5
Structured Query Language (SQL)_2
2STRUCTURED QUERY LANGUAGE (SQL)
SQL Statements:
Number of books published by New Moon Books in 2010:
SELECT Count(Books.title_id) AS CountOftitle_id, Publishers.pub_name FROM
Publishers LEFT JOIN Books ON Publishers.pub_id = Books.pub_id HERE
(((Books.pubdate)>=#1/1/2010# And (Books.pubdate)<=#12/31/2010#)) GROUP BY
Publishers.pub_name HAVING (((Publishers.pub_name)="New Moon Books"));
What was the highest royalty paid for a book?
SELECT Max(Books.royalty) AS MaxOfroyalty FROM Books;
Identify the five authors that made the highest royalty.
SELECT TOP 5 B.title, B.royalty FROM Books AS B WHERE (((B.royalty) In (Select
TOP 5 Bo.royalty From Books Bo Where Bo.title_id = B.title_id Order By B.royalty DESC)))
ORDER BY B.royalty DESC;
Identify who were the top 10 titles by sales.
SELECT TOP 5 B.title, B.ytd_sales FROM Books AS B WHERE (((B.ytd_sales) In
(Select TOP 10 Bo.ytd_sales From Books Bo Where Bo.title_id = B.title_id Order By
B.ytd_sales DESC ))) ORDER BY B.ytd_sales DESC;
Structured Query Language (SQL)_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Data Modelling Database Design Analysis 2022
|5
|715
|14

Assignment on what is Data Design?
|4
|662
|17

Desklib Study Material Library: ERD Relationship, SQL Queries
|7
|1319
|264

NoSQL Database: Types and Uses
|9
|848
|395

Database Technologies Assignment 1
|11
|1115
|70

NoSQL Database: Key-Value, Document-Based, Column-Based, Graph-Based
|11
|689
|420