Mysql Code Samples



Filters


Query to find 2nd largest value in a column in Table
Reshma | 4 years, 8 months
SELECT MAX (column_name) 
FROM table_name 
WHERE column_name NOT IN (SELECT Max (column_name) 
mysql second largest
Drop table in Sql
sonia shaik | 4 years, 9 months
Drop table Table_name;
sql mysql
IFNULL in MySQL
Reshma | 4 years, 8 months
SELECT 
IFNULL(
  (SELECT NAME 
The result will be the name when the given id is there in the table ,Otherwise it will return NULL v
if null mysql
MySQL | RENAME USER
Reshma | 4 years, 8 months
RENAME USER 'RAJ' @ 'localhost' TO 'AMIT' @ 'localhost';

RENAME USER 'PRIYA' @ 'localhost' TO 'DI
The RENAME USER statement can be used in MySQL if a MySQL administrator wants to change the username
rename mysql
MySQL | DROP USER
Reshma | 4 years, 8 months
DROP USER 'user' @ 'host';
mysql drop
MySQL | DEFAULT() Function
Reshma | 4 years, 8 months
SELECT DEFAULT (COLUMN_NAME) FROM TABLE_NAME;
The DEFAULT() function returns the default value for table column.
default() mysql
MySQL | BIN() Function
Reshma | 4 years, 8 months
SELECT BIN(5);

SELECT BIN(12);
The BIN() function in MySQL is used to convert a decimal number to its binary equivalent. This func
mysql bin()
MySQL | CREATE USER Statement
Reshma | 4 years, 8 months
CREATE USER 'user_name' @ 'localhost' IDENTIFIED BY 'password';
create user mysql
Mathematical functions in MySQL
Reshma | 4 years, 8 months
SELECT AVG(SALARY) FROM EMPLOYEES;

SELECT MAX(column_name)
mathematical functions mysql
SQL | ALTER to change the name of the column
Reshma | 4 years, 8 months
ALTER TABLE TABLE_NAME RENAME COLUMN TO NEW_COLUMN;
alter column mysql
Prev Next