AmitDiwan has Published 8358 Articles
AmitDiwan
570 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
327 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
AmitDiwan
146 Views
For faster querying, you need to use MySQL IN(). Let us first create a table −mysql> create table DemoTable1538 -> ( -> ClientId int, -> ClientName varchar(20) -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert ... Read More
AmitDiwan
108 Views
For this can use DATE_FORMAT() in MySQL. Let us first create a table −mysql> create table DemoTable -> ( -> PurchaseDate date, -> Amount int -> ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable ... Read More
AmitDiwan
366 Views
For this, use BETWEEN keyword. Let us first create a table −mysql> create table DemoTable1537 -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20) -> ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command −mysql> ... Read More
AmitDiwan
2K+ Views
Let us first create a table. We have set one of the columns with type TINYINT −mysql> create table DemoTable -> ( -> EmployeeId int, -> isMarried tinyint -> ); Query OK, 0 rows affected (6.84 sec)Insert some records in the table using insert command −mysql> ... Read More
AmitDiwan
2K+ Views
For this, you can use WHERE clause with multiple LIKE. Let us first create a table −mysql> create table DemoTable1536 -> ( -> Sentence text -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1536 values('I ... Read More
AmitDiwan
668 Views
To order by the first letter, use ORDER BY CASE statement. Let us first create a table −mysql> create table DemoTable1535 -> ( -> Value varchar(100) -> ); Query OK, 0 rows affected (2.26 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1535 ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP