@@ -78,27 +78,47 @@ Returns the rounded value of a number.
7878``` sql
7979SELECT ROUND(salary, 2 ) FROM employees
8080```
81+ ``` sql
82+ -- Round the salary to the nearest whole number
83+ SELECT ROUND(salary) FROM employees;
84+ ```
8185## 12. CURRENT_DATE()
8286Returns the current date.
8387Retrieves the current date from the system.
8488``` sql
8589SELECT CURRENT_DATE ()
8690```
91+ ``` sql
92+ -- Select the current date and an employee's name
93+ SELECT CURRENT_DATE (), first_name FROM employees;
94+ ```
8795## 13. CURRENT_TIME()
8896Returns the current time.
8997Retrieves the current time from the system.
9098``` sql
9199SELECT CURRENT_TIME ()
92100```
101+ ``` sql
102+ -- Select the current time and an employee's name
103+ SELECT CURRENT_TIME (), first_name FROM employees;
104+ ```
93105## 14. DATE_FORMAT()
94106Formats a date according to a specified format.
95107Returns a formatted date string.
96108``` sql
97109SELECT DATE_FORMAT(hire_date, ' %Y-%m-%d' ) FROM employees
98110```
111+ ``` sql
112+ -- Format the hire date as day-month-year
113+ SELECT DATE_FORMAT(hire_date, ' %d-%m-%Y' ) FROM employees;
114+ ```
99115## 15. GROUP_CONCAT()
100116Concatenates strings from a group of rows into a single string.
101117Returns a concatenated string with values from a group.
102118``` sql
103119SELECT department, GROUP_CONCAT(first_name) AS employees FROM employees GROUP BY department
104120```
121+ ``` sql
122+ -- Concatenate all employee names in each department separated by a semicolon
123+ SELECT department, GROUP_CONCAT(first_name ORDER BY first_name ASC SEPARATOR ' ; ' ) AS employees FROM employees GROUP BY department;
124+ ```
0 commit comments