
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
Ankith Reddy has Published 996 Articles

Ankith Reddy
1K+ Views
You can combine the insert, values and select statement using below syntaxinsert into yourFirstTableName(yourColumnName1, yourColumnName2, .......N) select yourColumnName1, yourColumnName2, .......N from yourSecondTableName where yourCondition;To understand the above syntax, let us create two tables in which first table will get the record from the second table.Let us create the first table ... Read More

Ankith Reddy
1K+ Views
To find all upper case strings in a MySQL table, you need to use BINARY UPPER() function. The syntax is as follows:SELECT *FROM yourTableName WHERE yourColumnName=BINARY UPPER(yourColumnName);To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table FindUpperCaseDemo -> ... Read More

Ankith Reddy
1K+ Views
You can use SUBSTRING() from MySQL to limit length of strings. The syntax is as followsSELECT SUBSTRING(yourColumnName, 1, yourIntegerValueToGetTheCharacters) as anyVariableName from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table limitLengthOfLongTextDemo -> ( ... Read More

Ankith Reddy
465 Views
As you know the DECIMAL() method takes two parameter. The first parameter tells about the total number of digits and second parameter tells about number of digits after decimal point. Therefore, if you use DECIMAL(10, 10) that means you can use only 10 fractional digit.For Example: Store 0.9999999999 with DECIMAL(20, ... Read More

Ankith Reddy
1K+ Views
The function TIME_TO_SEC() can be used in MySQL. If you want to convert datetime to seconds use the strtotime() from PHP. The MySQL syntax is as follows:SELECT TIME_TO_SEC(ABS(timediff(‘yourDateTimeValue’, now())));Now you can convert PHP datetime to seconds with the help of strtotime().First, you need to install XAMPP server to run your ... Read More

Ankith Reddy
648 Views
To select yesterday’s date, use the subdate() function from MySQL. The syntax is as followsselect subdate(yourDatetimeColumnName) as anyVariableName from yourTableName;To understand the above syntax, let us create a tablemysql> create table YesterdayDateDemo -> ( -> VisitedDateTime datetime -> ); Query OK, 0 rows affected (0.59 sec)Let us now insert date ... Read More

Ankith Reddy
2K+ Views
To find rows and update with new value where column value ends with specific substring you need to use LIKE operator.The syntax is as follows:UPDATE yourTableName SET yourColumnName=’yourValue’ WHERE yourColumnName LIKE ‘%.yourString’;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> ... Read More

Ankith Reddy
5K+ Views
To generate serial number i.e. row count in MySQL query, use the following syntax.SELECT @yourVariableName − = @yourVariableName+1 anyAliasName, yourColumnName1, yourColumnName2, yourColumnName3, ....N from yourTableName , (select @yourVariableName − = 0) as yourVariableName;To understand the above syntax, let us create a table. The query to create a table ... Read More

Ankith Reddy
6K+ Views
Select non-empty column values using NOT IS NULL and TRIM() function. The syntax is as follows.SELECT * FROM yourTableName WHERE yourColumnName IS NOT NULL AND TRIM(yourColumnName) ' ';You can select non-empty value as well as whitespace from column using the same TRIM() function.To understand the syntax we discussed above, ... Read More

Ankith Reddy
2K+ Views
We can work with nested transactions in MySQL with the help of SAVEPOINT.Firstly, create a table. After that, begin the transaction.Now, insert records in the table created above. Use SAVEPOINT statement to set a named transaction savepoint with a name of identifier.Here are all the steps shown in the form ... Read More