Class 12 Informatics Practices Chapter 06 Β· 20 min read

πŸ“š MySQL Functions

Unit 2 Β· Ch 6 Oct 10, 2026
Chapter Quiz Share

Your marks are 87.456 β€” but the report card should show 87.5. A shop wants every customer name in CAPITAL letters on the bill. The school office needs to know which month each student joined. πŸ€” You could fix all this by hand… or you could let MySQL do it in one line using functions! This chapter answers the BIG questions: What is a function in SQL? How do math functions round and calculate numbers? How do text functions cut, search, change the case of and trim text? And how do date functions pull out the day, month and year from a date? Let's make MySQL do the hard work! πŸ› οΈ

πŸ’‘ How to use these notes

Every function in this chapter is a CBSE syllabus function β€” there are 24 of them, in three groups: Math (3), Text (14), Date (7). Pay particular attention to ROUND() with negative places, MID()/SUBSTR(), INSTR(), LEFT()/RIGHT(), TRIM(), and MONTHNAME()/DAYNAME(). For every output question, write the characters with their positions (1, 2, 3…) above the text first β€” that's how you never miss a letter!


6.1 🏁 Introduction β€” What is a Function?

A function is a ready-made command that takes some input (arguments), does a job, and returns a result. You've already used functions in Python β€” len(), max(), round(). MySQL has its own!

   ROUND( 87.456 , 1 )   β†’   87.5
   ─────  ──────   ─         ────
     β”‚      β”‚      β”‚           └─ result (returned value)
     β”‚      β”‚      └─ argument 2 (decimal places)
     β”‚      └─ argument 1 (the number)
     └─ function name

Analogy: A function is like a juicer 🍊 β€” you put in fruit (input), press the button, and get juice (output). You don't need to know how the motor works inside!

6.1.1 Single-Row vs Multiple-Row Functions πŸ”€

graph TD
    F["πŸ› οΈ MySQL FUNCTIONS"]
    S["1️⃣ Single-Row Functions\n(one result for EACH row)"]
    M["πŸ“Š Multiple-Row / Aggregate\n(one result for a GROUP of rows)"]
    MA["πŸ”’ Math\nPOWER, ROUND, MOD"]
    TX["πŸ”€ Text\nUPPER, MID, INSTR, TRIM…"]
    DT["πŸ“… Date\nNOW, MONTH, DAYNAME…"]
    AG["SUM, AVG, MAX,\nMIN, COUNT"]

    F --> S
    F --> M
    S --> MA
    S --> TX
    S --> DT
    M --> AG

    style S fill:#2196F3,color:#fff
    style M fill:#9C27B0,color:#fff
    style MA fill:#FF9800,color:#fff
    style TX fill:#4CAF50,color:#fff
    style DT fill:#F44336,color:#fff
Single-Row Functions Multiple-Row (Aggregate) Functions
Work on one row at a time Work on a group of rows together
Give one result per row (5 rows in β†’ 5 results out) Give one result for the whole group
e.g. UPPER(), ROUND(), YEAR() e.g. SUM(), AVG(), COUNT()

This chapter covers single-row functions. Aggregate functions are covered in the chapter Querying Using SQL.

πŸ“‹ Typical question

"Differentiate between single-row and multiple-row functions with one example each." β€” 2 marks Answer: A single-row function works on each row separately and returns one result for every row β€” e.g. UPPER(Name). A multiple-row (aggregate) function works on a group of rows and returns a single result for the whole group β€” e.g. SUM(Salary).


6.2 πŸ—‚οΈ Our Sample Table β€” Staff

Most examples in this chapter use this table. Functions can also be tried without any table β€” SELECT ROUND(87.456, 1); works on its own!

SELECT * FROM Staff;
+-------+-------------+----------+----------+---------+------------+---------+
| EmpID | Name        | Dept     | Salary   | Bonus   | JoinDate   | City    |
+-------+-------------+----------+----------+---------+------------+---------+
|   101 | Ananya Sen  | Sales    | 45250.75 | 1200.50 | 2021-04-12 | Kolkata |
|   102 | Rahul Verma | Accounts | 52800.40 |  950.00 | 2019-11-25 | Delhi   |
|   103 | Priya Nair  | Sales    | 38900.00 | 1580.25 | 2023-01-03 | Kochi   |
|   104 | Arjun Mehta | IT       | 67450.60 | 2100.00 | 2020-08-15 | Pune    |
|   105 | Sneha Iyer  | IT       | 59999.99 |  800.75 | 2024-06-30 | Chennai |
+-------+-------------+----------+----------+---------+------------+---------+

6.3 πŸ”’ Math Functions

6.3.1 POWER() ⚑

POWER(m, n) returns m raised to the power n (mⁿ). POW() is another name for it.

SELECT POWER(2, 3), POWER(5, 2), POWER(2, 10), POWER(4, 0.5);
+-------------+-------------+--------------+---------------+
| POWER(2, 3) | POWER(5, 2) | POWER(2, 10) | POWER(4, 0.5) |
+-------------+-------------+--------------+---------------+
|           8 |          25 |         1024 |             2 |
+-------------+-------------+--------------+---------------+

6.3.2 ROUND() 🎯

ROUND(n, d) rounds the number n to d decimal places. If d is left out, it rounds to a whole number.

SELECT ROUND(87.456), ROUND(87.456, 1), ROUND(87.456, 2), ROUND(87.5);
+---------------+------------------+------------------+-------------+
| ROUND(87.456) | ROUND(87.456, 1) | ROUND(87.456, 2) | ROUND(87.5) |
+---------------+------------------+------------------+-------------+
|            87 |             87.5 |            87.46 |          88 |
+---------------+------------------+------------------+-------------+

Negative d rounds to the LEFT of the decimal point β€” to tens, hundreds, thousands:

SELECT ROUND(1234.567, -1), ROUND(1234.567, -2), ROUND(1250, -2), ROUND(1749, -3);
+---------------------+---------------------+-----------------+-----------------+
| ROUND(1234.567, -1) | ROUND(1234.567, -2) | ROUND(1250, -2) | ROUND(1749, -3) |
+---------------------+---------------------+-----------------+-----------------+
|                1230 |                1200 |            1300 |            2000 |
+---------------------+---------------------+-----------------+-----------------+
   d = 2    β†’  87.456  β†’ 87.46     (2 places after the point)
   d = 0    β†’  87.456  β†’ 87        (whole number)
   d = -1   β†’  1234.567 β†’ 1230     (nearest ten)
   d = -2   β†’  1234.567 β†’ 1200     (nearest hundred)
   d = -3   β†’  1749     β†’ 2000     (nearest thousand)
πŸ”‘ The ROUND rule

Look at the digit just after the place you are rounding to. 5 or more β†’ round up; 4 or less β†’ keep it. So ROUND(1250, -2) β†’ the tens digit is 5 β†’ 1300.

🧠 Memory Trick: "Minus means move left" 🧠

A positive d keeps digits to the right of the point. A negative d rounds digits to the left of the point and turns them into zeros!

On a table:

SELECT Name, Salary, ROUND(Salary), ROUND(Salary, -3) FROM Staff;
+-------------+----------+---------------+-------------------+
| Name        | Salary   | ROUND(Salary) | ROUND(Salary, -3) |
+-------------+----------+---------------+-------------------+
| Ananya Sen  | 45250.75 |         45251 |             45000 |
| Rahul Verma | 52800.40 |         52800 |             53000 |
| Priya Nair  | 38900.00 |         38900 |             39000 |
| Arjun Mehta | 67450.60 |         67451 |             67000 |
| Sneha Iyer  | 59999.99 |         60000 |             60000 |
+-------------+----------+---------------+-------------------+

6.3.3 MOD() βž—

MOD(m, n) returns the remainder when m is divided by n β€” just like % in Python.

SELECT MOD(17, 5), MOD(20, 4), MOD(7, 10), MOD(-17, 5);
+------------+------------+------------+-------------+
| MOD(17, 5) | MOD(20, 4) | MOD(7, 10) | MOD(-17, 5) |
+------------+------------+------------+-------------+
|          2 |          0 |          7 |          -2 |
+------------+------------+------------+-------------+
⚠ MOD with a negative number keeps the sign of the FIRST number

In MySQL, MOD(-17, 5) gives -2, not 3. (Python's -17 % 5 gives 3 β€” they are different!)

Using MOD to find even/odd employee IDs:

SELECT EmpID, Name FROM Staff WHERE MOD(EmpID, 2) = 0;
+-------+-------------+
| EmpID | Name        |
+-------+-------------+
|   102 | Rahul Verma |
|   104 | Arjun Mehta |
+-------+-------------+
πŸ“‹ Typical question

"Write the output: SELECT ROUND(4567.891, -2), POWER(3, 3), MOD(29, 6);" β€” 2 marks Answer: 4600, 27, 5


6.4 πŸ”€ Text (String) Functions

Text functions work on character data like names and cities. Let's number the letters of a word β€” MySQL starts counting at 1 (not 0 like Python!):

   I  N  F  O  R  M  A  T  I  C  S
   1  2  3  4  5  6  7  8  9  10 11
⚠ In MySQL, the first character is position 1, not 0!

Python strings start at index 0, but SQL text functions start at 1. Mixing these up is the #1 mistake in output questions.

6.4.1 UCASE() / UPPER() and LCASE() / LOWER() πŸ” 

Function Does Example Result
UPPER(s) or UCASE(s) Converts to CAPITAL letters UPPER('India') INDIA
LOWER(s) or LCASE(s) Converts to small letters LCASE('India') india
SELECT UPPER(Name), LCASE(City) FROM Staff WHERE Dept = 'IT';
+-------------+-------------+
| UPPER(Name) | LCASE(City) |
+-------------+-------------+
| ARJUN MEHTA | pune        |
| SNEHA IYER  | chennai     |
+-------------+-------------+
🧠 Two names, same job 🧠

UCASE() = UPPER() and LCASE() = LOWER(). CBSE uses both pairs, so learn both names!

6.4.2 LENGTH() πŸ“

LENGTH(s) returns the number of characters in the text β€” spaces count too!

SELECT Name, LENGTH(Name) FROM Staff;
+-------------+--------------+
| Name        | LENGTH(Name) |
+-------------+--------------+
| Ananya Sen  |           10 |
| Rahul Verma |           11 |
| Priya Nair  |           10 |
| Arjun Mehta |           11 |
| Sneha Iyer  |           10 |
+-------------+--------------+

6.4.3 LEFT() and RIGHT() β¬…οΈβž‘οΈ

Function Returns Example Result
LEFT(s, n) The first n characters from the left LEFT('INFORMATICS', 4) INFO
RIGHT(s, n) The last n characters from the right RIGHT('INFORMATICS', 3) ICS
SELECT Name, LEFT(Name, 3), RIGHT(City, 2) FROM Staff;
+-------------+---------------+----------------+
| Name        | LEFT(Name, 3) | RIGHT(City, 2) |
+-------------+---------------+----------------+
| Ananya Sen  | Ana           | ta             |
| Rahul Verma | Rah           | hi             |
| Priya Nair  | Pri           | hi             |
| Arjun Mehta | Arj           | ne             |
| Sneha Iyer  | Sne           | ai             |
+-------------+---------------+----------------+

Analogy: LEFT() and RIGHT() are like tearing a strip of paper πŸ“œ β€” you tear off a piece from the left end or the right end. You always keep the edge!

6.4.4 MID() / SUBSTRING() / SUBSTR() βœ‚οΈ

MID(s, start, length) cuts out a piece of text starting at position start, taking length characters. SUBSTRING() and SUBSTR() do exactly the same job.

   MID('INFORMATICS', 3, 4)

   I  N  F  O  R  M  A  T  I  C  S
   1  2  3  4  5  6  7  8  9  10 11
         β””β”€β”€β”€β”€β”€β”€β”˜
         start at 3, take 4  β†’  FORM
SELECT MID('INFORMATICS', 3, 4), SUBSTRING('INFORMATICS', 6, 3), SUBSTR('INFORMATICS', 8);
+--------------------------+--------------------------------+--------------------------+
| MID('INFORMATICS', 3, 4) | SUBSTRING('INFORMATICS', 6, 3) | SUBSTR('INFORMATICS', 8) |
+--------------------------+--------------------------------+--------------------------+
| FORM                     | MAT                            | TICS                     |
+--------------------------+--------------------------------+--------------------------+
  • If length is left out, it takes everything till the end (SUBSTR('INFORMATICS', 8) β†’ TICS).
  • A negative start counts from the right end:
SELECT SUBSTR('PRACTICES', -3), SUBSTR('PRACTICES', -5, 2);
+-------------------------+----------------------------+
| SUBSTR('PRACTICES', -3) | SUBSTR('PRACTICES', -5, 2) |
+-------------------------+----------------------------+
| CES                     | TI                         |
+-------------------------+----------------------------+

On a table β€” first name of each employee (everything before the space), using INSTR (next section):

SELECT Name, MID(Name, 1, INSTR(Name, ' ') - 1) AS FirstName FROM Staff;
+-------------+-----------+
| Name        | FirstName |
+-------------+-----------+
| Ananya Sen  | Ananya    |
| Rahul Verma | Rahul     |
| Priya Nair  | Priya     |
| Arjun Mehta | Arjun     |
| Sneha Iyer  | Sneha     |
+-------------+-----------+
🧠 Memory Trick: "MID = Middle piece" 🧠

LEFT takes from the left edge, RIGHT from the right edge, and MID can take a piece from anywhere in the middle β€” you just tell it where to start and how much to take.

6.4.5 INSTR() πŸ”

INSTR(s, sub) returns the position where sub first appears in s. If it is not found, it returns 0.

SELECT INSTR('COMPUTER', 'PUT'), INSTR('BANANA', 'AN'), INSTR('MYSQL', 'Z');
+--------------------------+-----------------------+---------------------+
| INSTR('COMPUTER', 'PUT') | INSTR('BANANA', 'AN') | INSTR('MYSQL', 'Z') |
+--------------------------+-----------------------+---------------------+
|                        4 |                     2 |                   0 |
+--------------------------+-----------------------+---------------------+
SELECT Name, INSTR(Name, 'a') FROM Staff;
+-------------+------------------+
| Name        | INSTR(Name, 'a') |
+-------------+------------------+
| Ananya Sen  |                1 |
| Rahul Verma |                2 |
| Priya Nair  |                5 |
| Arjun Mehta |                1 |
| Sneha Iyer  |                5 |
+-------------+------------------+
⚠ INSTR is NOT case sensitive (for normal text)

INSTR(Name, 'a') also finds a capital A β€” that's why "Ananya Sen" gives 1. And INSTR returns only the first match, not all of them.

6.4.6 LTRIM(), RTRIM() and TRIM() 🧹

These remove extra spaces that users often type by mistake.

Function Removes spaces from Example (' Hi ') Result
LTRIM(s) the left (leading) LTRIM(' Hi ') 'Hi '
RTRIM(s) the right (trailing) RTRIM(' Hi ') ' Hi'
TRIM(s) both sides TRIM(' Hi ') 'Hi'

Spaces are invisible, so let's measure them with LENGTH():

SELECT LENGTH('   Hello   '), LENGTH(LTRIM('   Hello   ')), LENGTH(RTRIM('   Hello   ')), LENGTH(TRIM('   Hello   '));
+-----------------------+------------------------------+------------------------------+-----------------------------+
| LENGTH('   Hello   ') | LENGTH(LTRIM('   Hello   ')) | LENGTH(RTRIM('   Hello   ')) | LENGTH(TRIM('   Hello   ')) |
+-----------------------+------------------------------+------------------------------+-----------------------------+
|                    11 |                            8 |                            8 |                           5 |
+-----------------------+------------------------------+------------------------------+-----------------------------+
⚠ TRIM never removes the spaces in the MIDDLE

TRIM(' Ravi Kumar ') gives 'Ravi Kumar' β€” the two spaces between the words stay!

Analogy: TRIM is like a tailor trimming loose threads βœ‚οΈ from both ends of a cloth β€” the design in the middle is never touched.

πŸ“‹ Typical question

"Write the output: SELECT LEFT('CBSE EXAM', 4), MID('CBSE EXAM', 6, 2), INSTR('CBSE EXAM', 'E'), LENGTH(TRIM(' CBSE '));" β€” 2 marks Answer: CBSE, EX, 4, 4


6.5 πŸ“… Date Functions

Dates in MySQL are written as 'YYYY-MM-DD'. Date functions let us pull out parts of a date.

6.5.1 NOW() and DATE() πŸ•’

Function Returns
NOW() The current date and time (from the computer's clock)
DATE(x) Only the date part of a date-time value
SELECT NOW(), DATE(NOW());
+---------------------+-------------+
| NOW()               | DATE(NOW()) |
+---------------------+-------------+
| 2026-10-05 05:17:13 | 2026-10-05  |
+---------------------+-------------+

(Your output will show the date and time at which you run the query.)

SELECT DATE('2026-10-05 14:30:00');
+-----------------------------+
| DATE('2026-10-05 14:30:00') |
+-----------------------------+
| 2026-10-05                  |
+-----------------------------+

6.5.2 YEAR(), MONTH(), DAY() πŸ—“οΈ

   '2021-04-12'
    ────  ──  ──
     β”‚    β”‚   └─ DAY()   β†’ 12
     β”‚    └─ MONTH()     β†’ 4
     └─ YEAR()           β†’ 2021
SELECT Name, JoinDate, YEAR(JoinDate), MONTH(JoinDate), DAY(JoinDate) FROM Staff;
+-------------+------------+----------------+-----------------+---------------+
| Name        | JoinDate   | YEAR(JoinDate) | MONTH(JoinDate) | DAY(JoinDate) |
+-------------+------------+----------------+-----------------+---------------+
| Ananya Sen  | 2021-04-12 |           2021 |               4 |            12 |
| Rahul Verma | 2019-11-25 |           2019 |              11 |            25 |
| Priya Nair  | 2023-01-03 |           2023 |               1 |             3 |
| Arjun Mehta | 2020-08-15 |           2020 |               8 |            15 |
| Sneha Iyer  | 2024-06-30 |           2024 |               6 |            30 |
+-------------+------------+----------------+-----------------+---------------+

6.5.3 MONTHNAME() and DAYNAME() πŸ“›

Function Returns Example Result
MONTHNAME(d) Name of the month MONTHNAME('2021-04-12') April
DAYNAME(d) Name of the weekday DAYNAME('2021-04-12') Monday
SELECT Name, MONTHNAME(JoinDate), DAYNAME(JoinDate) FROM Staff;
+-------------+---------------------+-------------------+
| Name        | MONTHNAME(JoinDate) | DAYNAME(JoinDate) |
+-------------+---------------------+-------------------+
| Ananya Sen  | April               | Monday            |
| Rahul Verma | November            | Monday            |
| Priya Nair  | January             | Tuesday           |
| Arjun Mehta | August              | Saturday          |
| Sneha Iyer  | June                | Sunday            |
+-------------+---------------------+-------------------+
🧠 Memory Trick: number vs name 🧠

MONTH() and DAY() give numbers (4, 12). Add NAME β€” MONTHNAME(), DAYNAME() β€” and you get words (April, Monday)!

⚠ DAY() is NOT the weekday!

DAY('2021-04-12') gives 12 (the date of the month). For the weekday, use DAYNAME() β†’ Monday.

Date functions in WHERE β€” staff who joined before 2021:

SELECT Name, JoinDate FROM Staff WHERE YEAR(JoinDate) < 2021;
+-------------+------------+
| Name        | JoinDate   |
+-------------+------------+
| Rahul Verma | 2019-11-25 |
| Arjun Mehta | 2020-08-15 |
+-------------+------------+
πŸ“‹ Typical question

"Write a query to display the name and the month name of joining of all staff who joined in the month of January." β€” 1 mark Answer:

SELECT Name, MONTHNAME(JoinDate) FROM Staff WHERE MONTH(JoinDate) = 1;

6.6 🧩 Using Functions Together

Functions can be nested β€” the output of one becomes the input of another. MySQL works from the inside out.

SELECT UPPER(LEFT(City, 3)) AS Code, ROUND(Salary / 12) AS MonthlyPay FROM Staff WHERE Dept = 'Sales';
+------+------------+
| Code | MonthlyPay |
+------+------------+
| KOL  |       3771 |
| KOC  |       3242 |
+------+------------+
   UPPER( LEFT('Kolkata', 3) )
          └──── 'Kol' β”€β”€β”€β”€β”˜      ← inner function first
   UPPER('Kol')  β†’  'KOL'        ← then the outer function

🧾 All 24 Syllabus Functions at a Glance

Group Function Example Result
Math POWER(m, n) POWER(2, 5) 32
Math ROUND(n, d) ROUND(56.789, 1) 56.8
Math MOD(m, n) MOD(23, 4) 3
Text UCASE() / UPPER() UPPER('cbse') CBSE
Text LCASE() / LOWER() LOWER('CBSE') cbse
Text MID() / SUBSTRING() / SUBSTR() MID('PYTHON', 2, 3) YTH
Text LENGTH() LENGTH('MySQL') 5
Text LEFT() LEFT('PYTHON', 2) PY
Text RIGHT() RIGHT('PYTHON', 2) ON
Text INSTR() INSTR('PYTHON', 'TH') 3
Text LTRIM() / RTRIM() / TRIM() TRIM(' ab ') ab
Date NOW() NOW() current date and time
Date DATE() DATE('2026-10-05 09:15:00') 2026-10-05
Date MONTH() MONTH('2026-10-05') 10
Date MONTHNAME() MONTHNAME('2026-10-05') October
Date YEAR() YEAR('2026-10-05') 2026
Date DAY() DAY('2026-10-05') 5
Date DAYNAME() DAYNAME('2026-10-05') Monday

⚠️ Common Errors and Misconceptions

Mistake What's Wrong Correct Understanding
Counting text positions from 0 SQL starts at 1 MID('ABC', 1, 1) is A
ROUND(1234.5, -2) = 1234.50 Negative d rounds to the left It gives 1200
MOD(-17, 5) = 3 MySQL keeps the sign of the first number It gives -2
DAY() gives the weekday DAY() gives the date number Use DAYNAME() for Monday, Tuesday…
MONTH('2026-10-05') = October MONTH() gives a number 10; use MONTHNAME() for October
INSTR() returns -1 when not found MySQL returns 0 Not found β†’ 0
"TRIM removes all spaces" Only leading and trailing Spaces between words stay
"LENGTH ignores spaces" Spaces are characters LENGTH('a b') = 3
LEFT('PYTHON') LEFT needs the number of characters LEFT('PYTHON', 2)
Text without quotes: UPPER(india) It is treated as a column name UPPER('india')

🎯 Sample Board Exam Questions

Q1: Very Short Answer [1 mark each]

a) What will SELECT INSTR('INFORMATION', 'FOR'); return? Answer: 3

b) Name the function that returns the weekday name of a date. Answer: DAYNAME()

c) What is the output of SELECT ROUND(73.586, 2);? Answer: 73.59

d) Write another name for the UCASE() function. Answer: UPPER()

e) What does LENGTH(TRIM(' SQL ')) return? Answer: 3

Q2: Output Based [2 marks]

SELECT MID('CYBER SAFETY', 7, 3), RIGHT('CYBER SAFETY', 4), POWER(2, 4), MOD(25, 7);

Answer:

+---------------------------+--------------------------+-------------+------------+
| MID('CYBER SAFETY', 7, 3) | RIGHT('CYBER SAFETY', 4) | POWER(2, 4) | MOD(25, 7) |
+---------------------------+--------------------------+-------------+------------+
| SAF                       | FETY                     |          16 |          4 |
+---------------------------+--------------------------+-------------+------------+

Q3: Output Based [3 marks]

Using the Staff table, write the output of:

SELECT LCASE(Dept), MONTHNAME(JoinDate), ROUND(Bonus, -2) FROM Staff WHERE Salary > 50000;

Answer:

+-------------+---------------------+------------------+
| LCASE(Dept) | MONTHNAME(JoinDate) | ROUND(Bonus, -2) |
+-------------+---------------------+------------------+
| accounts    | November            |             1000 |
| it          | August              |             2100 |
| it          | June                |              800 |
+-------------+---------------------+------------------+

Q4: Write Queries [1 mark each]

a) Display the names of all staff in capital letters.

SELECT UPPER(Name) FROM Staff;

b) Display the first 4 letters of each city.

SELECT LEFT(City, 4) FROM Staff;

c) Display the name and the year of joining of each staff member.

SELECT Name, YEAR(JoinDate) FROM Staff;

d) Display the salary of each staff member rounded to the nearest hundred.

SELECT Name, ROUND(Salary, -2) FROM Staff;

e) Display the names of staff whose name has more than 10 characters.

SELECT Name FROM Staff WHERE LENGTH(Name) > 10;

Q5: Short Answer [2 marks]

Differentiate between ROUND(n, 1) and ROUND(n, -1) using n = 256.78.

Answer: ROUND(256.78, 1) rounds to one decimal place and gives 256.8. ROUND(256.78, -1) rounds to the nearest ten (left of the decimal point) and gives 260.


✏️ Practice Problems

  1. Write the output: SELECT POWER(3, 4), ROUND(9876.54, -3), MOD(50, 8);
  2. Write the output: SELECT LEFT('NETWORK', 3), RIGHT('NETWORK', 4), MID('NETWORK', 2, 3);
  3. What does INSTR('PROGRAMMING', 'M') return? What about INSTR('PROGRAMMING', 'X')?
  4. Write a query to display the last 3 characters of each staff member's name.
  5. Write a query to display the names of staff who joined on a Monday.
  6. Write a query to display each staff member's name and their total pay (Salary + Bonus) rounded to a whole number.
  7. Write the output: SELECT LENGTH(' CS & IP '), LENGTH(LTRIM(' CS & IP '));
  8. Write a query to display the names of staff who joined in the month of August.
  9. What is the difference between DAY() and DAYNAME()? Give an example.
  10. Write a query to display the position of the first space in each staff member's name.
  11. Write the output of SELECT UCASE(MID('database', 1, 4));
  12. Why does SELECT UPPER(Name) FROM Staff; not change the names stored in the table?
Take the Chapter 06 Quiz Custom Quiz
Solved Board Questions

Practice real board exam questions for this chapter.

View Solved Board Questions
Learning Support

Need Help With This Chapter?

Save key topics for exam revision, ask questions to teachers, or submit content corrections.

Verified Doubts & Teacher Answers

Chapter 06 Quiz