- 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
Found 4378 Articles for MySQL
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
560 Views
You can use REGEXP. Let us first create a table −mysql> create table DemoTable ( Name varchar(100) ); Query OK, 0 rows affected (1.61 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('JohnSmith'); Query OK, 1 row affected (0.73 sec) mysql> insert into DemoTable values('John Doe'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('DavidMiller'); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable values('Carol Taylor'); Query OK, 1 row affected (0.27 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
To fetch multiple values wit LIKE, use the LIKE operator along with OR operator. Let us first create a table −mysql> create table DemoTable1027 ( Id int, Name varchar(100) ); Query OK, 0 rows affected (1.64 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1027 values(100, 'John'); Query OK, 1 row affected (0.72 sec) mysql> insert into DemoTable1027 values(20, 'Chris'); Query OK, 1 row affected (0.56 sec) mysql> insert into DemoTable1027 values(200, 'Robert'); Query OK, 1 row affected (0.84 sec) mysql> insert into DemoTable1027 values(400, 'Mike'); Query OK, 1 row affected (0.47 sec)Display all ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
398 Views
Let us first create a table −mysql> create table DemoTable ( CustomerName varchar(100), CustomerCountryName varchar(100) ); Query OK, 0 rows affected (0.95 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', 'US'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('Bob', 'UK'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values('Carol', NULL); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('David', 'AUS'); Query OK, 1 row affected (0.32 sec) mysql> insert into DemoTable values('Mike', NULL); Query OK, 1 row affected (0.18 sec)Display all records ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
213 Views
You can use concat(). Let us first create a table −mysql> create table DemoTable ( Value int ); Query OK, 0 rows affected (0.73 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(200); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(200); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(200); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values(100); Query ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
184 Views
For this, you can use LENGTH() along with REPLACE(). Let us first create a table −mysql> create table DemoTable ( Value int ); Query OK, 0 rows affected (1.22 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10002000); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values(00000); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(400560); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+----------+ | Value | +----------+ | 10002000 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
199 Views
For this, you can use IFNULL(). Let us first create a table −mysql> create table DemoTable ( FirstName varchar(100), LastName varchar(100) ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John', 'Doe'); Query OK, 1 row affected (0.29 sec) mysql> insert into DemoTable values(NULL, 'Taylor'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('David', NULL); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values(NULL, 'Miller'); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
112 Views
For this, you can use IFNULL(). Let us first create a table −mysql> create table DemoTable ( Value1 int, Value2 int ); Query OK, 0 rows affected (0.75 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10, NULL); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable values(20, 40); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable values(3, NULL); Query OK, 1 row affected (0.20 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+--------+--------+ | Value1 | Value2 ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
194 Views
Following is the declaration for a UNIQUE clause in MySQL −create table yourTableName ( yourColumnName1 dataType, yourColumnName2 dataType, UNIQUE(yourColumnName1), UNIQUE(yourColumnName1) );Let us first create a table −mysql> create table DemoTable ( Value int, Value2 int, UNIQUE(Value), UNIQUE(Value2) ); Query OK, 0 rows affected (13.98 sec)Insert some records in the table using insert command. Here, duplicate records won’t insert because we have used UNIQUE above −mysql> insert into DemoTable values(10, 20) ; Query OK, 1 row affected (0.32 sec) mysql> insert into DemoTable values(10, 30); ERROR 1062 (23000): Duplicate entry '10' for key ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
416 Views
Let us first create a table −mysql> create table DemoTable ( AdmissionDate datetime ); Query OK, 0 rows affected (8.99 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2010-01-10 12:30:45'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('2010-01-10 12:30:45'); Query OK, 1 row affected (0.46 sec) mysql> insert into DemoTable values('2010-01-10 12:30:45'); Query OK, 1 row affected (0.71 sec) mysql> insert into DemoTable values('2010-01-12 12:30:45'); Query OK, 1 row affected (1.22 sec) mysql> insert into DemoTable values('2010-01-20 12:30:45'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable values('2010-01-20 ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
7K+ Views
In this section we will see how to check whether a number is Palindrome or not using the PL/SQL. In PL/SQL code, some group of commands are arranged within a block of related declaration of statements.A number is palindrome if the number, and the reverse of that number are same. Suppose a number 12321, this is palindrome, but 12345 is not a palindrome.ExampleDECLARE n number; m number; temp number:=0; rem number; BEGIN n :=12321; m :=n; while n>0 loop rem := mod(n, 10); temp := (temp*10)+rem; ... Read More