Category Archives: MySQL

MYSQL Date And Time Types

This tutorial will help you to understand about “MYSQL Date and Time Data Types”. Storage Required For Date And Time Types YEAR Type TIME Type DATE, DATETIME AND TIMESTAMP Type Storage Requirements for Date and Time Types TIME, DATETIME, TIMESTAMP storage details showed in following table. Data Type Storage Required YEAR 1 byte DATE 3 […]

MYSQL Numeric Data Types

This tutorial will help you to understand about “MYSQL Numeric Data Types”. Storage Required For Numeic Types Integer Types Storage Required For Numeic Types Data Type Storage Required TINY INT 1 byte SMALL INT 2 bytes MEDIUM INT 3 bytes INT INTEGER 4 bytes BIGINT 8 bytes FLOAT(p) 4 bytes DOUBLE[PRECISION], REAL 8 bytes DECIMAL(M,D), […]

MYSQL Server Connection

MYSQL Connection To Server MYSQL Disconnect From Server MYSQL Connection To Server Host, user and password parameters are needed to connect the mysql server. We have to connect server like this shell>mysql -h host -u user -p Enter Password: ******* host – Where MYSQL server is running user – username of MYSQL server password – […]

MYSQL String Data Types

This tutorial will help you to understand about “MYSQL String Types”. It contains the storage required for string types, CHAR type, VARCHAR type, TEXT types, BLOB types, ENUM type and SET TYPE. Storage Required For String Types CHAR ,VARCHAR TYPE TEXT TYPES BLOB TYPES ENUM TYPE SET TYPE Storage Requirements for String Types In the […]

MySQL Upcoming Birthdays Query

When I try to write a query for upcoming birthdays using MYSql, I get the below query to fetch the upcoming birthdays from the employee list. It may be useful to you. select * from ( select id, datediff(DATE_FORMAT(date_of_birth,concat(‘%’,YEAR(CURDATE()),’-%m-%d’)),NOW()) as no_of_days from employee union select id, datediff(DATE_FORMAT(date_of_birth,concat(‘%’,(YEAR(CURDATE())+1),’-%m-%d’)),NOW()) as no_of_days from employee ) AS upcomingbirthday WHERE […]