- 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
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
91 Views
To order by word in MySQL, you need to use ORDER BY FIELD(). Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentFirstName varchar(20), StudentFavouriteSubject varchar(100) ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentFirstName, StudentFavouriteSubject) values('Larry', 'Java'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(StudentFirstName, StudentFavouriteSubject) values('Sam', 'C'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable(StudentFirstName, StudentFavouriteSubject) values('Bob', 'MongoDB'); Query OK, 1 row affected (0.17 sec) mysql> ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
2K+ Views
Let us first create a Stored Procedure. Following is the query to create a stored procedure using MySQL Workbench.use business; DELIMITER // DROP PROCEDURE IF EXISTS SP_GETMESSAGE; CREATE PROCEDURE SP_GETMESSAGE() BEGIN DECLARE MESSAGE VARCHAR(100); SET MESSAGE="HELLO"; SELECT CONCAT(MESSAGE, ' ', 'MYSQL!!!!'); END // DELIMITER ;Here is the screenshot of stored procedure in MySQL workbench −You need to execute the above stored procedure with the help of below symbol shown in the screenshot −Now you can call the stored procedure with the help of CALL command.call SP_GETMESSAGE();The screenshot is as follows −Now again you can execute the above statement with the ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
761 Views
Use ALTER command to remove a value from an enum in MySQL. Let us first create a table −mysql> create table DemoTable ( `Rank` ENUM('LOW', 'MEDIUM', 'HIGH') ); Query OK, 0 rows affected (0.52 sec)Let us check the description of table.mysql> DESC DemoTable;This will produce the following output −+-------+-----------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-----------------------------+------+-----+---------+-------+ | Rank | enum('LOW', 'MEDIUM', 'HIGH') | YES | | NULL | | +-------+-----------------------------+------+-----+---------+-------+ 1 row in set (0.00 sec)Following is the query to remove a ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
2K+ Views
The short is equivalent to MySQL’s small int. The Java short takes 2 bytes that has the range -32768 to 32767 while MySQL smallint also take 2 bytes with same range.Here is the demo code of short in Java −public class SmallIntAsShortDemo { public static void main(String[] args) { short value = 32767; System.out.println(value); value = -32768; System.out.println(value); // value = 32768; // System.out.println(value); } }The snapshot is as follows −This will produce the following output −32767 -32768Here is the snapshot of the output we ran in EclipseIDE −The MySQL smallint takes 2 bytes with same range.
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
129 Views
You can use trim() for this.Let us first create a table −mysql> create table DemoTable ( UserId varchar(100) ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command. Here, we have added a question mark (?) to the end of some of the strings −mysql> insert into DemoTable values('User123?'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('User777'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('User456'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('User133?'); Query OK, 1 ... Read More
![Smita Kapse](https://www.tutorialspoint.com/assets/profiles/13597/profile/60_103706-1512718957.jpg)
413 Views
You cannot use except in MySQL. You can work with NOT IN operator to get the same result. Let us first create a table −mysql> create table DemoTable1 ( Number1 int ); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(100); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1 values(200); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1 values(300); Query OK, 1 row affected (0.13 sec)Display all records from the table using select statement:mysql> select *from DemoTable1This will produce the following output −+---------+ | Number1 | +---------+ | 100 | | 200 | | 300 | +---------+ 3 rows in set (0.00 sec)Following ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
109 Views
Both pow() and power() are synonyms. Let us see the syntax −select pow(yourValue1, yourValue2); OR select power(yourValue1, yourValue2);Now we will see some examples.Using pow()mysql> select POW(4, 3);This will produce the following output −+----------+ | POW(4, 3) | +----------+ | 64 | +----------+ 1 row in set (0.00 sec)Using power()mysql> select POWER(4, 3);This will produce the following output −+------------+ | POWER(4, 3) | +------------+ | 64 | +------------+ 1 row in set (0.00 sec)Let us first create a table and look into the above concept ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
59 Views
You cannot use from as a column name directly because from is a reserved word in MySQL. To avoid this, you need to use backtick symbol. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, `from` varchar(100), Name varchar(10) ); Query OK, 0 rows affected (0.92 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(`from`, Name) values('US', 'John'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(`from`, Name) values('UK', 'Carol'); Query OK, 1 row affected (0.14 sec) mysql> ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
4K+ Views
You cannot use EXCEPT in MySQL, instead use the NOT IN operator. Let us first create a table −mysql> create table DemoTable ( Number1 int ); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(200); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(300); Query OK, 1 row affected (0.13 sec)Display all records from the table using select statement −mysql> select * from DemoTable;This will produce the following output −+---------+ | ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
132 Views
Both pow() and power() are synonyms in MySQL. Following is the syntax −select pow(yourValue1, yourValue2); OR select power(yourValue1, yourValue2);Let us implement both the above syntaxes.Using POW()mysql> select POW(4, 3);This will produce the following output −+----------+ | POW(4, 3) | +----------+ | 64 | +----------+ 1 row in set (0.00 sec)Using POWER()mysql> select POWER(4, 3);This will produce the following output −+------------+ | POWER(4, 3) | +------------+ | 64 | +------------+ 1 row in set (0.00 sec)Let us implement the above syntax in a table −mysql> create table ... Read More