
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6705 Articles for Database

96 Views
It can be done with the SHOW COLUMNS statement. Its Syntax would be as follows:SyntaxSHOW COLUMNS FROM tab_name IN db_nameHere, tab_name is the name of the table from which we want to see the list of columns.Db_name is the name of the database, in which the table is storedExampleIn the example, we are currently using the database ‘query’ and getting the list of columnsfrom a table named ‘arena’ stored in MySQL ‘database’:mysql> SHOW COLUMNS FROM arena IN mysql\G *************************** 1. row *************************** Field: id Type: int(10) unsigned zerofill Null: NO Key: PRI Default: NULL Extra ... Read More

522 Views
We can update MySQL table after removing a particular string from the values of a column by using TRIM() function along with UPDATE clause. Following the example from ‘examination_btech’ table will make it clearer −ExampleSuppose if we want to delete the values ‘(CSE)’, from last, of column ‘Course’ and want to update the table too then it can be done with the help of the following query −mysql> Update examination_btech SET Course = TRIM(Trailing '(CSE)' FROM Course); Query OK, 10 rows affected (0.13 sec) mysql> Select * from examination_btech; +-----------+----------+--------+ | RollNo | Name | Course | +-----------+----------+--------+ | 201712001 | Rahul ... Read More

124 Views
Suppose in our ‘Employee’ table we are having NULL as the value of ‘salary’ column for two employees. The data, shown as follows, is itself not meaningful.mysql> Select * from employee; +----+--------+--------+ | ID | Name | Salary | +----+--------+--------+ | 1 | Gaurav | 50000 | | 2 | Rahul | 20000 | | 3 | Advik | 25000 | | 4 | Aarav | 65000 | | 5 | Ram | 20000 | | 6 | Mohan | 30000 | | 7 | Aryan | NULL | | 8 ... Read More

554 Views
It is quite possible to use a SELECT statement as the first argument of MySQL IF() function. To make it understand, consider the data as follows from table ‘Students’. mysql> Select * from Students; +----+-----------+-----------+----------+----------------+ | id | Name | Country | Language | Course | +----+-----------+-----------+----------+----------------+ | 1 | Francis | UK | English | Literature | | 2 | Rick | ... Read More

3K+ Views
It is quite possible to use MySQL IF() function within SELECT statement by providing the name of the column along with a condition as the first argument of IF() function. To understand it, consider the following data from table ‘Students’.mysql> Select * from Students; +----+-----------+-----------+----------+----------------+ | id | Name | Country | Language | Course | +----+-----------+-----------+----------+----------------+ | 1 | Francis | UK | English | Literature | | 2 | Rick | USA | English | History | ... Read More

157 Views
MySQL IF() function is one of the MySQL control flow functions that returns a value based on a condition. It is sometimes referred to as IF ELSE or IF THEN ELSE function. Basically, it takes three expressions and if the first expression is true (not ZERO and not NULL), it returns the second expression. Otherwise, it returns the third expression. Its syntax is as follows −SyntaxIF(expr, value_if_true, value_if_false)Here expr is the expression having some condition.Value_if_true is the value to return if expr evaluates to TRUE.Value_if_false is the value to return if expr evaluates to FALSE.Examplemysql> Select IF(100=100, 'YES', 'NO'); +------------------------+ | ... Read More

210 Views
As we know that there is no BOOLEAN data type in MySQL hence by using TRUE or true, FALSE or false we can enter Boolean values in MySQL statement.Examplemysql> Select TRUE,FALSE; +------+-------+ | TRUE | FALSE | +------+-------+ | 1 | 0 | +------+-------+ 1 row in set (0.00 sec) mysql> Select true,false; +------+-------+ | TRUE | FALSE | +------+-------+ | 1 | 0 | +------+-------+ 1 row in set (0.00 sec)

580 Views
Combining of functions in MySQL is quite possible by providing a function as the argument of other function. It is also called nesting of functions. To understand it, consider some examples belowmysql> Select UPPER(CONCAT('www.', 'tutorialspoint', '.com'))As Tutorials; +------------------------+ | Tutorials | +------------------------+ | WWW.TUTORIALSPOINT.COM | +------------------------+ 1 row in set (0.00 sec) mysql> Select LOWER(CONCAT('WWW.', 'TUTORIALSPOINT', '.COM'))As Tutorials; +------------------------+ | Tutorials | +------------------------+ | www.tutorialspoint.com | +------------------------+ 1 row in set (0.00 sec)The above queries combine UPPER() and LOWER() function with CONCAT() function.Similarly, we can combine more ... Read More

143 Views
If we want to use POWER() function with column’s data values then the first argument i.e. the base would be the name of the column and the second argument i.e. the exponent would be as specified by us. To understand it considers a table ‘Employee’ having the following records −mysql> Select * from Employee; +----+--------+--------+ | ID | Name | Salary | +----+--------+--------+ | 1 | Gaurav | 50000 | | 2 | Rahul | 20000 | | 3 | Advik | 25000 | | 4 | Aarav | 65000 | | 5 | Ram | 20000 | ... Read More

343 Views
POWER() function is used to raise a number to the power of another number. POW() is the synonym of POWER() function. In these functions, the first arguments work as the base and the second argument works as the exponent. SyntaxPOWER(M, N) Here, M is the number which is the base of exponentiation. N is the number which is the exponent of exponentiation.Examplemysql> Select POWER(2,3),POW(2,3); +------------+----------+ | POWER(2,3) | POW(2,3) | +------------+----------+ | 8 | 8 | +------------+----------+ 1 row in set (0.00 sec)