Sql Queries Examples With Answers (40+ Examples) – C# Programming Example
SQL

Sql Queries Examples With Answers (40+ Examples)

There are move over 40 SQL queries and answers in this article. Queries are working on the following database.

 

SQL SELECT Queries Examples

 Example 1:  List all the records in the student chart

 

Example 2: List the nam,e surname and class of the student in the student table

 

Example 3: List the gender Female (F) records in the student table

 

Example 4 : List the names of each class in the way of being seen once in the student table

 

Example 5: List the students with Female gender and the class 10Math in the student table

Example 6: List the names, surnames and classes of the students in the class 10Math or 10Sci in the student table

Example 7: List the students name surname and school number in the student table

 

Example 8: List the students name and surname by combining them as name surname in the student table

 

Example 9: List the students with the names starting with “A” letter in the student table

 

Example 10: List the book names and pages count with number of pages between 50 and 200 in the book table

 

Example 11: List the students with names Emma Sophia and Robert in the student table

 

Example 12: List the students with names starting with A D and K in the student table

 

Example 13: List the names surnames classes and genders of males in 9Math or females in 9His in the student table

 

Example 14: List the males whose classes are 10Math or 10Bio

 

Example 15: List the students with birth year 1989 in the student table

 

Example 16: List the female students with  student numbers between 30 and 50

 

Example 17: List the students according to their names

 

Example 18: List the students by names for those with same names. List them by their surnames

 

Example 19: List the students in 10Math by decreasing school numbers

 

Example 20: List the first 10 records in the student chart

 

Example 21: List the first 10 records name surname and date of birth information in the student table

 

Example 22: List the book with the most page number

 

Example 23: List the youngest student in the student table

 

 Example 24: List the oldest student in the 10Math class

 

Example 25: List the books with the second letter N

 

Example 26: List the students by grouping according to their classes

 

Example 27: List the students to be different in each questioning randomly

 

Example 28: Pick a random student from student table

 

Example 29: Bring some random student’s name , surname and number from class 10Math

 

SQL INSERT INTO Queries

 

Example 30: Add the writer named Smith Allen to the authors table

 

Example 31: Add the genre of  biography to the genre table

 

Example 32: Add 10Math Class male named Thomas Nelson , 9Bio class female named Sally Allen and 11His Class female named Linda Sandra in one question

 

Example 33: Add a random student in the students chart to the writers chart as an authors

 

Example 34: Add students with student numbers between 10 and 30 as authors

 

Example 35: Add the writer named Cindy Brown and make him write his writer number (Note: The last increased rate in automatic enhancing is hold in  @@IDENTITY factor)

 

SQL UPDATE Queries

 

Example 36: Change the class of the student whose school number is 3 from 10Bio to 10His

 

Example 37: Transfer all the students in 9Math Class to 10Math Class

 

Example 38: Increase all of the students’ score by 5 points

 

SQL DELETE Queries

NOTE 1: The most important thing in delete interrrogation is the part of condition.If the condition isn’t written, all records are included to the cleaning process..

NOT 2: TRUNCATE TABLE instruction will be given at the end of interrogation. (It is used for empting the table TRUNCATE TABLE TABLE NAME)

Example 39: Delete the author #25

 

SELECT …….. IS NULL Command

 

When searching for the records whose rate are null in the select questıons, you can’t search for field area=null to research the area whose fieald area are null , İt is used null statement.

Example 40: List the students whose birth dates are null

 

PULLING DATA FROM MULTI TABLE WORKING QUESTIONS (without using JOIN)

 

Example 41: List the name ,surname and the dates of received books of the student

 

 

 

 

Source:

For More SQL Query Examples(www.queryexamples.com)

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: