- 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
AmitDiwan has Published 11365 Articles
AmitDiwan
435 Views
For this, use the CAST() method in MySQL. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentHeight varchar(40) ) ; Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into ... Read More
AmitDiwan
588 Views
For this, use GROUP BY along with COUNT(*). Let us first create a table −mysql> create table DemoTable ( EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, EmployeeGender varchar(40) ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(EmployeeGender) ... Read More
AmitDiwan
239 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 ... Read More
AmitDiwan
343 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 ... Read More
AmitDiwan
58 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 ... Read More
AmitDiwan
296 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, ... Read More
AmitDiwan
480 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 ... Read More
AmitDiwan
251 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, ... Read More
AmitDiwan
397 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 ... Read More
AmitDiwan
145 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 ... Read More