Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 10740 Articles
AmitDiwan
883 Views
To fetch a specific column value, use LIKE clause. Let us first create a table −mysql> create table DemoTable1809 ( Name varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1809 values('John'); Query ... Read More
AmitDiwan
1K+ Views
For this, use GROUP_CONCAT() and CONCAT(). Let us first create a table −mysql> create table DemoTable1807 ( Id int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1807 values(101); Query OK, 1 row ... Read More
AmitDiwan
891 Views
To get data greater than equal to 1 day from the current date, use the concept of INTERVAL in MySQL.The current date is as follows −mysql> select curdate(); +------------+ | curdate() | +------------+ | 2019-11-29 | +------------+ 1 row in set (0.00 sec)We will first create a table −mysql> create ... Read More
AmitDiwan
203 Views
For this, you can use COALESCE(). Let us first create a table −mysql> create table DemoTable1805 ( Name1 varchar(20), Name2 varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1805 values('Chris', ... Read More
AmitDiwan
150 Views
For this, you can use GROUP BY clause. To find maximum value, use MAX() function. Let us first create a table −mysql> create table DemoTable1804 ( Id int, Marks1 int, Marks2 int, Marks3 int ); Query OK, 0 ... Read More
AmitDiwan
234 Views
For this, you can use CONCAT() with CURDATE().There is no function with the name CONTAINS() in MySQL.Let us first get the current date. The current date is as follows −mysql> select curdate();This will produce the following output −+------------+ | curdate() | +------------+ | 2019-11-28 | +------------+ 1 row in set ... Read More
AmitDiwan
166 Views
For this, you can use DISTINCT keyword. Let us first create a table −mysql> create table DemoTable1801 ( Name varchar(20), Score int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1801 ... Read More
AmitDiwan
563 Views
For alias, use the following syntax wherein we are display an alias name −select sum(yourColumnName) as anyAliasName from yourTableName;Let us first create a table −mysql> create table DemoTable1800 ( Salary int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table ... Read More
AmitDiwan
530 Views
For this, you can use group_concat() along with replace(). Let us first create a table −mysql> create table DemoTable1799 ( EmployeeId varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1799 values('101, 102, ... Read More
Select some data from a database table and insert into another table in the same database with MySQL
AmitDiwan
739 Views
To insert data from a table to another, use INSERT INTO statement. Let us first create a table −mysql> create table DemoTable1 ( Id int, FirstName varchar(20), Age int ); Query OK, 0 rows affected (0.00 sec)Insert some records in ... Read More