AmitDiwan has Published 10740 Articles

MySQL update datetime column values and add 10 years 3 months 22 days and 10 hours, 30 minutes to existing data?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:08:45

525 Views

For this, you can use INTERVAL in MySQL. Let us first create a table −mysql> create table DemoTable1509    -> (    -> ArrivalTime datetime    -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1509 values('2018-01-21 10:20:30'); Query ... Read More

Show a MySQL user-defined variables values in the result table?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:07:41

215 Views

Use @ for variable and concat_ws() to display concatenated result in the table. Let us first create a table −mysql> create table DemoTable1508    -> (    -> StudentFirstName varchar(20),    -> StudentLastName varchar(20)    -> ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using ... Read More

How to make MySQL display results in a single line?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:05:58

2K+ Views

For this, you can use group_concat(). Let us first create a table −mysql> create table DemoTable1507    -> (    -> Name varchar(20),    -> PaperSet int    -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1507 values('Chris', ... Read More

Remove space between two words in MySQL?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:03:57

382 Views

For this, you can use REPLACE(). Let us first create a table −mysql> create table DemoTable1506    -> (    -> Title text    -> ); Query OK, 0 rows affected (0.70 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1506 values('This is MySQL'); Query OK, ... Read More

How do I force the column alias to be of specific data type in MySQL?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:01:36

289 Views

For this, you can use CASE statement. Let us first create a table −mysql> create table DemoTable1505    -> (    -> Value integer unsigned,    -> Status tinyint(1)    -> ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into ... Read More

Swap a specific column value in MySQL

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:00:12

294 Views

Let us first create a table table −mysql> create table DemoTable1504    -> (    -> Id int,    -> FirstName varchar(20)    -> ); Query OK, 0 rows affected (0.83 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1504 values(101, 'Chris'); Query OK, 1 row ... Read More

Passing NULL to MySQL for auto increment?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:58:03

893 Views

Yes, we can pass NULL as in the below syntax −insert into yourTableName values(NULL, yourValue1, yourValue2, ...N);Let us first create a table −mysql> create table DemoTable1503    -> (    -> ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ClientName varchar(20),    -> ClientAge int    -> ); Query ... Read More

Getting the Largest Window Height and Width of the Console in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:57:36

265 Views

To get the largest window height of the Console, the code is as follows −Example Live Demousing System; public class Demo{    public static void Main(string[] args){       Console.WriteLine("Largest Window Height of the Console = "+Console.LargestWindowHeight);    } }OutputThis will produce the following output −Largest Window Height of the ... Read More

MySQL query for sorting on a columns partial value like number in “John_120 “

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:56:26

168 Views

For this, you can use SUBSTRING_INDEX() along with ORDER BY. Let us first create a table −mysql> create table DemoTable1502    -> (    -> StudentId varchar(40)    -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1502 values('John_120'); ... Read More

How to get Fourth Element of the Tuple in C#?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:54:53

110 Views

To get the fourth element of the Tuple, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(String[] args){       var tuple1 = Tuple.Create(75, 200, 500, 700, 100, 1200, 1500);       var tuple2 = Tuple.Create(75, 200, 500, 700, 100, ... Read More

Advertisements