- 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)
64 Views
Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(30) ); Query OK, 0 rows affected (0.70 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName) values('John Smith'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(StudentName) values('David Miller'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(StudentName) values('Carol Taylor'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(StudentName) values('John Doe'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(StudentName) values('Chris Brown'); Query OK, 1 row ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
911 Views
Let us first create a table −mysql> create table DemoTable ( Number text ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('7364746464, -'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('-, 8909094556'); Query OK, 1 row affected (0.23 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+--------------+ | Number | +--------------+ | 7364746464, - | | -, 8909094556 | +--------------+ 2 rows in set (0.00 sec)Following is ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
242 Views
Let us first create a table −mysql> create table DemoTable ( DueDate varchar(100) ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('August 04, 2019'); Query OK, 1 row affected (0.25 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+----------------+ | DueDate | +----------------+ | August 04, 2019 | +----------------+ 1 row in set (0.00 sec)Following is the query to format date −mysql> set @stringToDate=(select date_format(str_to_date(DueDate, '%M %d, %Y'), '%Y-%m-%d') from ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
351 Views
You can truncate the table to set auto_increment value to start from 1 in MySQL. Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY ); Query OK, 0 rows affected (1.44 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(); Query OK, 1 row affected (0.35 sec) mysql> insert into DemoTable values(); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable values(); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values(); Query OK, 1 row affected (0.06 sec)Display all records ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
61 Views
No, ^ is the Bitwise XOR operator in MySQL. For this, use POW() or POWER() from MySQL. Let us first create a table &minuns;mysql> create table DemoTable ( BaseValue int, PowerValue float ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(4, 1.9867); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(10, 6.789); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(20, 8.9); Query OK, 1 row affected (0.14 sec)Display all records from the table using select statement −mysql> select *from ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
298 Views
Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, CustomerName varchar(20), ProductPrice int ); Query OK, 0 rows affected (0.70 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(CustomerName, ProductPrice) values('Chris', 600); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable(CustomerName, ProductPrice) values('David', 450); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable(CustomerName, ProductPrice) values('Chris', 980); Query OK, 1 row affected (0.40 sec) mysql> insert into DemoTable(CustomerName, ProductPrice) values('Mike', 1200); Query OK, 1 row affected (0.11 sec) mysql> insert into ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
485 Views
For this, you can use GROUP_CONCAT(). You also need to use DISTINCT to fetch distinct records. Let us first create a table −mysql> create table DemoTable( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(40), Score int ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name, Score) values('Chris', 56); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable(Name, Score) values('Robert', 78); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(Name, Score) values('Chris', 56); Query OK, 1 row affected (0.42 sec) mysql> insert ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
254 Views
Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, PurchaseDate date, SalePrice int ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(PurchaseDate, SalePrice) values('2018-01-10', 450); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(PurchaseDate, SalePrice) values('2019-12-25', 1000); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable(PurchaseDate, SalePrice) values('2016-12-02', 5560); Query OK, 1 row affected (0.07 sec) mysql> insert into DemoTable(PurchaseDate, SalePrice) values('2015-02-20', 4550); Query OK, 1 row affected (0.18 sec) mysql> insert into ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
398 Views
No, MySQL UPDATE won’t overwrite values if they are identical. Let us first create a table −mysql> create table DemoTable ( StudentId int, StudentMathMarks int, StudentMySQLMarks int ); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(1, 56, 78); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values(2, 88, 99); Query OK, 1 row affected (0.15 sec) mysql> inse rt into DemoTable values(3, 34, 98); Query OK, 1 row affected (0.13 sec)Display all records from the table using select statement −mysql> select *from ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
153 Views
To count, use the MySQL COUNT(*). However, with UNION ALL you would be able to get a combined count of string. Let us first create a table −mysql> create table DemoTable1 ( Name varchar(20) ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command. We are inserting string values in the first table −mysql> insert into DemoTable1 values('Chris'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1 values('Robert'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1 values('Mike'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable1 ... Read More