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 10744 Articles
AmitDiwan
974 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Name text -> ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John [John] Smith'); Query OK, 1 row affected (0.30 sec) mysql> ... Read More
AmitDiwan
156 Views
Let us first create a table −mysql> create table DemoTable1544 -> ( -> Id int , -> Name varchar(20) -> ); Query OK, 0 rows affected (2.47 sec)Insert some records in the table using insert command. We have inserted multiple data using SET clause −mysql> insert ... Read More
AmitDiwan
390 Views
Let us first create a table −mysql> create table DemoTable -> ( -> EmailId varchar(30) -> ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John123@example.com'); Query OK, 1 row affected (0.12 sec) mysql> insert into ... Read More
AmitDiwan
764 Views
For this, use aggregate function COUNT(*). Let us first create a table −mysql> create table DemoTable1543 -> ( -> Value1 int, -> Value2 int -> ); Query OK, 0 rows affected (1.36 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1543 values(57, ... Read More
AmitDiwan
140 Views
For this, you can use GROUP_CONCAT(), COUNT() along with GROUP BY clause. Let us first create a table −mysql> create table DemoTable -> ( -> CompanyId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> CompanyName varchar(20) -> ); Query OK, 0 rows affected (0.62 sec)Insert some records ... Read More
AmitDiwan
184 Views
Let us first create a table −mysql> create table DemoTable1541 -> ( -> EmployeeId int, -> EmployeeFirstName varchar(20) NOT NULL -> ); Query OK, 0 rows affected (0.94 sec)Here is the query to create an index on the column −mysql> create index emp_name_index on DemoTable1541(EmployeeFirstName); Query ... Read More
AmitDiwan
549 Views
You can use the CEIL() function from MySQL. Let us first create a table. Here, we have taken the first column as VARCHAR −mysql> create table DemoTable -> ( -> Value varchar(20), -> UpdateValue int -> ); Query OK, 0 rows affected (1.08 sec)Insert some records ... Read More
AmitDiwan
295 Views
To remove string from the values EMO1, EMP2, etc., you need to use RIGHT() along with LENGTH(). Let us first create a table −mysql> create table DemoTable1540 -> ( -> EmployeeCode varchar(20) -> ); Query OK, 0 rows affected (0.39 sec)Insert some records in the table using ... Read More
AmitDiwan
1K+ Views
At first, find the current date and get the difference between joining date and current date using the DATEDIFF().The current date is as follows −mysql> select curdate(); +------------+ | curdate() | +------------+ | 2019-10-26 | +------------+ 1 row in set (0.00 sec)Let us first create a table −mysql> create table ... Read More
AmitDiwan
2K+ Views
To combine columns into rows, use UNION ALL. Following is the syntax −Syntaxselect yourColumnName1 from yourTableName union all select yourColumnName2 from yourTableName;Let us first create a table −mysql> create table DemoTable -> ( -> Value1 int, -> Value2 int -> ); Query OK, 0 rows ... Read More