Important QnA MySQL functions class 12

In this article, you will read important QnA MySQL functions class 12. So here we begin!

QnA MySQL functions class 12

As per the sample paper pattern, first, we will see the objective types questions i.e. Fill in the blanks, MCQs and True/False. Let us start this article QnA MySQL functions class 12 with objective type questions.

Objective type questions

  1. The __________ function returns the date with constant time after execution.
  2. The ________ function returns the date with the exact time when the command is executed.
  3. Which of the following function returns the date value in ‘YYYY-MM-DD’ from system date?
    1. curdate()
    2. date()
    3. now()
    4. sysdate()
  4. The date() function returns the date value in ‘MM-DD-YYYY’ from the selected date. (True/False)
  5. The month() function returns the month number from the selected date. (True/False)
  6. Which of the following function returns the name of the month from selected date?
    1. month(date)
    2. month_name(date)
    3. monthname(date)
    4. name_month()
  7. You cannot display the only year from the selected date in MySQL. (True/False)
  8. Which of the following function returns only the day number from month of selected date?
    1. day(date)
    2. dayno(date)
    3. day_number(date)
    4. date(date)
  9. The __________ function returns the day name from the specified date.
  10. The ____________ function returns day of the year falling at the specified date.
  11. The __________ command counts all values including the duplicate values from the table at once.
  12. Which of the following function count all the values except null?
    1. count(*)
    2. count(column_name)
    3. count(not null)
    4. count(null)
  13. The functions return a single value as output is known as ____________ function.
  14. The _______ function ignores the null value in counting records.
  15. Which of the following function returns the maximum values from selected values?
    1. maxi()
    2. maximum()
    3. max()
    4. maxm()

The answers for QnA MySQL functions class 12 objective type questions are as following:

  1. now()
  2. sysdate()
  3. 1. curdate()
  4. False
  5. True
  6. 3. monthname(date)
  7. False
  8. day(date)
  9. dayname
  10. dayofyear()
  11. all
  12. 2. count(column_name)
  13. aggregate functions
  14. distinct
  15. count(*)

The next section of QnA MySQL functions class 12 consists of short answer questions.

Short Answer questions

Dear Students refer this article for answers.

Recommended : MySQL Date/Time & Aggregate Functions

  1. Differentiate between now() and sysdate() functions.
  2. What will be the output of following SQL statements:
    1. select curdate() + 5;
    2. select current_date() – date(‘2020-10-15’)
    3. select current_date;
  3. How to use date() function in MySQL? Elaborate your answer with example.
  4. What will be the output of following SQL statements:
    1. select month(now()) + year(now());
    2. select dayofweek(now());
    3. select day(curdate()) + dayofmonth(curdate());
    4. select dayname(curdate()), dayofweek(sysdate());
    5. select dayofyear(now())
  5. What do you mean by aggregate() functions? Expalain in short.
  6. What is the difference between single-row functions and multi-row functions?
  7. What distinct in MySQL? Explain in with an example.
  8. Explain the following functions with syntax and examples:
    1. max
    2. min
    3. sum
    4. average
    5. count
  9. What is the difference between count() and count(*)?

In the next section of QnA MySQL functions class 12 we will talk about case study based question.

  1. Consider the following table “salesmen” and write answers for the below-given questions:
IDNameAgeTDateAreaCommGender
101Hemant252020-07-15North0M
102Manasvi232020-06-14East1500F
103Kumkum202020-07-10North2300F
104Vijay252020-09-15EastnullM
105Garima202020-04-10West2400F
106Mayank222020-04-22North2000M
107Ashok212020-10-12East1100M
108Shailesh232020-10-19West1800M
109Vaishali242020-11-02SouthnullF

Observe above given table and answer the following questions which is case study based questions for QnA MySQL functions class 12.

  1. Write SQL commands for the following:
    1. Count all salesman who earns the commission.
    2. Display the day of transaction dates along with ID, name, date and day format.
    3. Add 5 days into a date and display a report.
    4. Display the day of the year for all transaction dates.
    5. Display the weekday of the transactions from the east and north area.
    6. Display the month names from the salesmen table.
    7. Display the day names from the salesman table.
    8. Extract the months from the transaction and display a report along with ID, Name, Month and Commission.
    9. Display the day name of the transaction date exactly 5 years back on the day of the transaction.
    10. Find the difference between month and day for all salesman transactions and prepare a report in this format ID, Name, Month, Difference.
    11. Add the day of year and day of week fro the transaction date.
    12. Display maximum commission from the salesmen.
    13. Display the total commission earned by salesmen.
    14. Display the average commission from the table.
    15. Find the difference between maximum and minimum commission.
    16. To count distinct area from the table.
    17. Display minimum commission earned by male salesmen.
    18. Display maximum commission earned by female salesmen.
    19. Find the average commission by male salesmen.
    20. Find the sum of the commission of north area.
  2. What will be the output of the following queries:
    1. select avg(comm) from salesmen where area=’East’;
    2. select count(area) from salesmen;
    3. select count(*) from salesmen;
    4. select count(comm) from salesmen;
    5. select max(age) from salesmen;
    6. select min(age) from salesmen;
    7. select sum(comm) + avg(comm) from salesmen;

I hope you enjoyed the article QnA MySQL functions class 12. If you have any doubt or query feel free to ask in comment section.

Thank you very much the visit.

Click on below link to access all contents of IP class 12:

Recommended: IP Class 12

One thought on “Important QnA MySQL functions class 12”

Leave a Reply