- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 1070 Articles
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
977 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](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
316 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](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
873 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](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
504 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](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
1K+ 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](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
4K+ 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](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
5K+ 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](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
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
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
463 Views
The '_thread' module in Python library provides a low-level interface for working with light-weight processes having multiple threads sharing a global data space. For synchronization, simple locks (also called mutexes or binary semaphores) are defined in this module. The 'threading' built-in module provides a higher-level threading API built on top ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
3K+ Views
To find the MySQL data directory, we can simply use the variable datadir. Let us see how to use the variable with select statement.The query is as follows −mysql> select @@datadir;Here is the output+---------------------------------------------+ | @@datadir ... Read More