×
Home
Jobs
Tools
Coding Ground
Current Affairs
UPSC Notes
Online Tutors
Whiteboard
Net Meeting
Tutorix
Login
Packages
Categories
Java
JSP
iOS
HTML
Android
Python
C Programming
C++ Programming
C#
PHP
CSS
Javascript
jQuery
SAP
SAP HANA
Data Structure
RDBMS
MySQL
Mathematics
8085 Microprocessor
Operating System
Digital Electronics
Analysis of Algorithms
Mobile Development
Front End
Web Development
Selenium
MongoDB
Computer Network
General Topics
Library
Videos
Q/A
eBooks
Login
Library
Videos
eBooks
Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Rishi Rathor
has Published
184
Answers
Calculate Age from given Date of Birth in MySQL?
MySQL
MySQLi
Database
Rishi Rathor
Published on 11-Jan-2019 12:42:06
To calculate age in MySQL from Date of Birth, you can use the following syntax −SELECT YEAR(CURRENT_TIMESTAMP) - YEAR(yourColumnName) - (RIGHT(CURRENT_TIMESTAMP, 5) < RIGHT(yourColumnName, 5)) as anyVariableName from yourTableName;To understand the above concept, let us create a table. The following is the query to create a table.mysql> create table AgeCalculatesDemo ...
Read More
Create a table in MySQL that matches another table?
MySQL
MySQLi
Database
Rishi Rathor
Published on 11-Jan-2019 12:30:07
To create a table in MySQL that matches with another table, use CREATE TABLE command with LIKE operator. The syntax is as follows −create table yourNewTableName like yourOldTableName;The above syntax creates structure of the table.If you want all records then use INSERT INTO…...SELECT *FROM command. The syntax is as follows ...
Read More
How do you force MySQL LIKE to be case sensitive?
MySQL
MySQLi
Database
Rishi Rathor
Published on 11-Jan-2019 12:20:03
To force MySQL LIKE to be case sensitive with the help of LIKE BINARY, the following is the syntax −select yourColumnName like binary 'anyStringValue' from yourTableName;To understand the above concept, let us create a table. The following is the query to create a table −mysql> create table LikeBinaryDemo −> ...
Read More
Get the difference between two timestamps in seconds in MySQL?
MySQL
MySQLi
Database
Rishi Rathor
Published on 10-Jan-2019 17:35:08
To get difference between two timestamps in seconds, use two in-built functions TIME_TO_SEC() and TIMEDIFF() in MySQL. The syntax is as follows −select time_to_sec(timediff(yourCoulnName1, yourCoulnName2)) as anyVariableName from yourTableName;To understand the above concept, let us first create a table. The query to create a table.mysql> create table TimeToSecond ...
Read More
Do a select in MySQL based only on month and year?
MySQL
MySQLi
Database
Rishi Rathor
Published on 10-Jan-2019 17:25:15
To select MySQL based on month and year, use in-built function YEAR() and MONTH(). The syntax is as follows −select *from yourTableName where YEAR(yourColumnName) = YearValue AND MONTH(yourColumnName) = monthValue;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create ...
Read More
Update column size in MySQL and increase its size?
MySQL
MySQLi
Database
Rishi Rathor
Published on 10-Jan-2019 17:11:18
To update the column size, you can use alter command. The syntax is as follows −alter table yourTableName change yourColumnName yourColumnName data type;To understand the above syntax, let us create a table. The query to create a table −mysql> create table DataTruncated −> ( ...
Read More
How to change the column position of MySQL table without losing column data?
MySQL
MySQLi
Database
Rishi Rathor
Published on 10-Jan-2019 16:58:10
You can change the column position of MySQL table without losing data with the help of ALTER TABLE command. The syntax is as follows −ALTER TABLE yourTableName MODIFY yourColumnName1 data type AFTER yourColumnName2;To understand the above concept, let us create a table. The query to create a table with some ...
Read More
Add a temporary column with a value in MySQL?
MySQL
MySQLi
Database
Rishi Rathor
Published on 10-Jan-2019 12:19:31
You can add a temporary column with value with the help of the following syntax −select yourColumnName1, yourColumnName2, .....N ,yourTemporaryColumnValue as yourTemporaryColumnName from yourTableName;To add a temporary column with a value, let us create a table. The following is the query −mysql> create table TemporaryColumnWithValueDemo −> ( ...
Read More
Get date format DD/MM/YYYY with MySQL Select Query?
MySQL
MySQLi
Database
Rishi Rathor
Published on 10-Jan-2019 11:57:40
Use the STR_TO_DATE() function from MySQL to set a date format for displaying DD/MM/YYYY date. The syntax is as follows −SELECT STR_TO_DATE(yourColumnName, ’%d/%m/%Y) as anyVariableName from yourTableName.To understand the above syntax, let us create a table −mysql> create table DateFormatDemo −> ( −> IssueDate varchar(100) ...
Read More
Generate an integer sequence in MySQL?
MySQL
MySQLi
Database
Rishi Rathor
Published on 10-Jan-2019 11:48:34
To create an integer sequence in MySQL, use AUTO_INCREMENT. Remember, there is no special command to create an integer sequence. The AUTO_INCREMENT will help to create an integer sequence in MySQL.The AUTO_INCREMENT begins from 1 by default. You can change with another number with the help of alter command. Let ...
Read More
Previous
1
...
3
4
5
6
7
8
9
...
19
Next
Advertisements
Print
Add Notes
Bookmark this page
Report Error
Suggestions
Save
Close
Dashboard
Logout