- 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
Arjun Thakur has Published 1109 Articles
Arjun Thakur
1K+ Views
You can implement MySQL Like IN() with the help of Regular Expression (regexp) as well. The syntax is as follows −select *from yourTableName where yourColumName regexp ‘value1|value2|value3……|valueN’;To understand the above logic, you need to create a table. Let us first create a table −mysql> create table INDemo ... Read More
Arjun Thakur
911 Views
The limit of auto_increment integer depends on column data type. Displayed as follows:The data type TINYINT range is 127 The data type UNSIGNED TINYINT range is 255 The data type SMALLINT range is 32767 The data type UNSIGNED SMALLINT range is 65535 The data type MEDIUMINT range is 8388607 The ... Read More
Arjun Thakur
899 Views
To set user variable from result of query in MySQL, you need to move that variable into the assignment.To understand the above concept, let us first create a table. The query to create a table is as follows −mysql> create table UserVariable -> ( ... Read More
Arjun Thakur
44 Views
You can use CASE statement to get the results that match some expressions−SELECT *FROM yourTableName WHERE CASE WHEN yourColumnName1 = yourValue1 THEN 1 ELSE 0 END + CASE WHEN yourColumnName2 = yourValue2 THEN 1 ELSE 0 END + CASE WHEN yourColumnName3 = yourValue3 THEN 1 ELSE 0 END ... Read More
Arjun Thakur
106 Views
To achieve this, you can use the following syntax in MySQL −select *from yourTableName\G;Here, G can be used for vertical purpose. You need to add yourTableName.Let us create a table in order to understand the above syntax. Creating a table with the help of CREATE command.The following is the query ... Read More
Arjun Thakur
110 Views
You need to use ALTER command to change collation to utf8_bin. The syntax is as follows:ALTER TABLE yourTableName COLLATE utf8_general_ci;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table CollateDemo -> ( -> Id int NOT NULL ... Read More
Arjun Thakur
8K+ Views
Yes, you can use the LOWER() or LCASE() from MySQL to convert a string to lowercase. Both methods can be used to convert the string into lowercase.Here is the syntax of LOWER() −lower(‘yourStringValue);Or you can use LCASE().The syntax is as follows −lcase(‘yourStringValue);Let us see an example of LOWER(). The query ... Read More
Arjun Thakur
2K+ Views
Whenever you retrieve datetime from a table, the datetime gives ‘YYYY-MM-DD’ format. If you want to change the output, then you need to use in-built date_format() from MySQL.The syntax is as follows −SELECT DATE_FORMAT(yourDatetimeColumnName, yourFormat) as anyVariableName from yourTableName;To understand the above syntax, let us first create a table. The ... Read More
Arjun Thakur
8K+ Views
To select data where a field has min value, you can use aggregate function min(). The syntax is as follows.SELECT *FROM yourTableName WHERE yourColumnName=(SELECT MIN(yourColumnName) FROM yourTableName);To understand the above syntax, let us create a table. The query to create a table is as follows.mysql> create table MinValueDemo -> ( ... Read More
Arjun Thakur
2K+ Views
You can create a table from view using create table select syntax. The syntax is as follows −CREATE TABLE yourTableName AS SELECT yourColumnName1, yourColumnName2, yourColumnName3, ........N from yourViewName;To run the above query, first you need to create a table and after that you need to create a view on that ... Read More