0% found this document useful (0 votes)
6 views14 pages

SQL Query Samples for Database Management

The document contains a series of SQL queries for selecting data from various tables in a database, including Author, Book, Category, Loan, and Publisher. It showcases examples of filtering, ordering, and joining data, as well as aggregating information such as total fines and book counts by language. The queries are designed to retrieve specific information based on different criteria and relationships between the tables.

Uploaded by

moustafasamy490
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views14 pages

SQL Query Samples for Database Management

The document contains a series of SQL queries for selecting data from various tables in a database, including Author, Book, Category, Loan, and Publisher. It showcases examples of filtering, ordering, and joining data, as well as aggregating information such as total fines and book counts by language. The queries are designed to retrieve specific information based on different criteria and relationships between the tables.

Uploaded by

moustafasamy490
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1-SELECT TOP (1000) [authorID],[authorName] FROM [New_db_12_es].[dbo].

[Author]
2- SELECT * FROM Book;
3- Select * From Category;
4- Select * From Loan;
5- Select * From Publisher;
6- Select * From
##SQL Query Samples

1- Select * From [User] Where Fname LIKE ‘Ali’;


2 Select * From Book ORDER BY bookprice ASC;
3- Select * From Book WHERE language = ‘English’ AND bookprice<100;
4 - Select * From Loan WHERE loanState = ‘Borrowed’;
5- SELECT [Link],[Link],[Link]

From Loan L

Join Book B ON [Link] = [Link]

Where [Link] = 3 , SELECT [Link],[Link] , [Link]

From Loan L

Join Book B ON [Link] = [Link]

WHERE [Link] = 3 ; Where [Link] = 3;


6- SELECT SUM(fineAmount) AS totalFines FROM Loan;
SELECT language, COUNT(*) AS totalBooks

FROM Book

GROUP BY language;
7-Select * FROM UserLoanView;

You might also like