IFNULL in MySQL

if null mysql 5 years, 3 months ago
SELECT IFNULL( (SELECT NAME from employee where id = 2), 'NULL') as NAME;
1304
Instructions

The result will be the name when the given id is there in the table ,Otherwise it will return NULL value

Posted By
Create a user table in MySQL database and ins
CREATE TABLE `user` (
    `username` VARCHAR(25) NOT NULL,
    `email` VARCHAR(150) NOT NULL,
mysql
kishore_kumar
Connect to MySQL database with python mysql c
# pip install mysql-connector

from mysql import connector
python mysql mysql-connector
kishore_kumar
Drop table in Sql
Drop table Table_name;
sql mysql
sonia shaik
Creating table using MySQLi Object-oriented P
<?php
$servername = "localhost";
$username = "username";
mysqli table creation mysql
Reshma
Creating table using MySQLi Procedural proced
<?php
$servername = "localhost";
$username = "username";
mysqli table creation mysql
Reshma
MySQL | BIN() Function
SELECT BIN(5);

SELECT BIN(12);
mysql bin()
Reshma
MySQL | RENAME USER
RENAME USER 'RAJ' @ 'localhost' TO 'AMIT

RENAME USER 'PRIYA' @ 'localhost' TO 'DI
rename mysql
Reshma
SQL | ALTER to change the name of the table
ALTER TABLE TABLE_NAME RENAME TO NEW_TAB
alter table mysql
Reshma
SQL | ALTER to change the name of the column
ALTER TABLE TABLE_NAME RENAME COLUMN TO 
alter column mysql
Reshma
MySQL | DEFAULT() Function
SELECT DEFAULT (COLUMN_NAME) FROM TABLE_
default() mysql
Reshma
MySQL | DROP USER
DROP USER 'user' @ 'host';
mysql drop
Reshma
Changing MySQL User Password Using The SET PA
SET PASSWORD FOR 'user' @ 'localhost' = 
mysql set password
Reshma
Changing MySQL User Password Using The ALTER
ALTER USER user@localhost IDENTIFIED BY 
alter password mysql
Reshma
Changing MySQL User Password Using UPDATE Sta
UPDATE USER SET AUTHENTICATION_STRING = 
WHERE USER = 'USER_NAME' AND
HOST = 'LOCALHOST';
password changing using update mysql
Reshma
MySQL | CREATE USER Statement
CREATE USER 'user_name' @ 'localhost' ID
create user mysql
Reshma
MySQL | CREATE USER Statement (creating more
CREATE USER
'user_name' @ 'localhost' IDENTIFIED BY 
'user_name' @ 'localhost' IDENTIFIED BY 
creating multiple users mysql
Reshma
COUNT() Function
SELECT COUNT(SALARY)
FROM EMPLOYEES
WHERE SALARY >= 40000;
count() mysql
Reshma
Mathematical functions in MySQL
SELECT AVG(SALARY) FROM EMPLOYEES;

SELECT MAX(column_name)
mathematical functions mysql
Reshma
MySQL | DATABASE() and CURRENT_USER() Functio
SELECT DATABASE();

SELECT CURRENT_USER();
mysql current user database
Reshma
Query to find 2nd largest value in a column i
SELECT MAX (column_name) 
FROM table_name 
WHERE column_name NOT IN (SELECT Max (co
mysql second largest
Reshma