Practical on SQL (12)

  1. Create a database College.
  2. Delete a database College.
  3. Create a database OurSchool.
  4. Use database OurSchool.
  5. Create a table student with rollno, class, studentid, sname, address, phone, salary with suitable variable.
  6. Create a table parents with sno, studentid, parentname, phone, address
  7. Create a table persons with a primary key field.
  8. Delete a column salary from student table.
  9. Insert any 5 records into student table.
  10. Display all the records.
  11. Display only class 11 records. (Record must be in table)
  12. Display only name and address of class 12 records. (Record must be in table)
  13. Add a column section to student table.
  14. Update your table field section from varchar(50) into varchar(3)
  15. Update section to all the students.
  16. Update name from Ram to Shyam whose roll no is 10. (Record must be in table)
  17. Delete a single record whose roll no is 5 from student table.
  18. Delete all the data from student table.
  19. Delete student table.
  20. Make a auto increment for sno field in a table.
  21. Display only unique records from the column of a table.
  22. Display all the records whose address is butwal.
  23. Update all the records whose address is butwal to Kathmandu.
  24. Delete all the records whose address is Kathmandu.
  25. Display all the detail of roll no 5.
  26. Display all the records whose Class is 12 and age is 13.
  27. Display all the records whose address is Pokhara or Bhairawaha.
  28. Display all the records whose age is not less than 18.
  29. Display all the records whose country is Nepal and city is Pokhara or Bhairawaha.
  30. Display all the records whose country is not Germany and Not USA.
  31. Select all the records ordered by name in ascending order.
  32. Select all the records ordered by salary in descending order.
  33. Arrange the records by Country and Customer Name. (If coutry will be same then it checks for the customer's name)
  34. Display all the records where address field is null.
  35. Display all the records where phone number field is filled.
  36. Display all the records for first 10 records only.
  37. Display only first 50% records only.
  38. Display first three records' whose country is Nepal.
  39. Find the cheapest price from the products.
  40. Find the expensive price from the products.
  41. Find the total number of records from the country Nepal.
  42. Find the average price of a product.
  43. Calculate the sum of all product of a specific brand.
  44. Find total price of order.
  45. Display all the products whose name starts from a.
  46. Display all the products whose name ends with a.
  47. Display all the records whose name have r in second position.
  48. Display all the records whose name have at least 3 characters and a is in second position.
  49. Display all the records whose city starts from a,b,c,d,e.
  50. Display all the records whose city does not starts from a,b,c,d,e.
  51. Select all the records whose customers that are located in Butwal, Pokhara, Kathmandu.
  52. Select all the records whose products price is in between 20000 and 50000.
  53. Select all the records whose products price is in between 20000 and 50000.
  54. Select all the records ordered by product name whose address is Butwal and Kathmandu.
  55. Select all the records whose order is between 05/07/2022 and 05/07/2023.
  56. Display all the records from customer, CustomerID as ID and customername as customer.
  57. Display all the records from customer and while displaying combine address, postalcode, city, country as Address.
  58. Solve the following.
  59. Notice that the "CustomerID" column in the "Orders" table refers to the "CustomerID" in the "Customers" table. The relationship between the two tables above is the "CustomerID" column.
  60. Then, we can create the following SQL statement (that contains an INNER JOIN), that selects records that have matching values in both tables:

  1. (INNER) JOIN: Returns records that have matching values in both tables
  2. LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table
  3. RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table
  4. FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table
61. Join all the records of any two tables.
62. Join only distinct data from any two tables.

Comments

Popular posts from this blog

Question Collection-11

Important Questions for XII