Set a custom value for NULL or empty values in MySQL

AmitDiwan
Updated on 30-Sep-2019 08:00:43

558 Views

Let us first create a table −mysql> create table DemoTable (    Value varchar(100) ); Query OK, 0 rows affected (0.75 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('100'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(''); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('200'); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable values(null); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+-------+ | Value | +-------+ ... Read More

Find the number of logins between two dates in MySQL

AmitDiwan
Updated on 30-Sep-2019 07:59:03

103 Views

Use BETWEEN to find the logins between two dates. Let us first create a table −mysql> create table DemoTable (    Login datetime ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-08-10'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('2019-08-12'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('2019-08-20'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('2019-08-24'); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will ... Read More

Display multiple selected rows using MySQL IN()

AmitDiwan
Updated on 30-Sep-2019 07:57:35

432 Views

Let us first create a table −mysql> create table DemoTable1045 (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    FirstName varchar(100) )AUTO_INCREMENT=100; Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1045(FirstName) values('John'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1045(FirstName) values('Chris'); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable1045(FirstName) values('Robert'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1045(FirstName) values('Mike'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1045(FirstName) values('Adam'); Query OK, 1 row affected (0.08 sec)Display all records ... Read More

How to disable JavaScript in Internet Explorer (IE)?

vanithasree
Updated on 30-Sep-2019 07:57:16

205 Views

To disable JavaScript in Internet Explorer (IE), follow the below-given steps:Click the gear icon on the right-hand side:Now, a dialog box will open. Go to Security tab and click Custom level.After reaching the Security Settings, go to Scripting, then Active Scripting.Click Disable to disable JavaScript and press Ok.Now, JavaScript will disable after clicking Ok.

How to find whether a browser supports JavaScript or not?

vanithasree
Updated on 30-Sep-2019 07:55:38

605 Views

To find whether the browser supports JavaScript or nor, use the tag. The HTML tag is used to handle the browsers, which do recognize tag but do not support scripting. This tag is used to display an alternate text message.Here’s an example,           HTML noscript Tag                                              Your browser does not support JavaScript!          

Advanced sorting in MySQL to display strings beginning with J at the end even after ORDER BY

AmitDiwan
Updated on 30-Sep-2019 07:55:12

94 Views

For this, use ORDER BY LIKE operator. Let us first create a table −mysql> create table DemoTable (    Name varchar(100) ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('Adam'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Chris'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('Jace'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('David'); Query OK, 1 row affected (0.09 sec) mysql> insert into ... Read More

Display all products having the highest amount in a MySQL table with product details?

AmitDiwan
Updated on 30-Sep-2019 07:53:23

318 Views

Use MAX() along with subquery for this Here, MAX() is used to get the maximum amount. Let us first create a table −mysql> create table DemoTable (    ProductId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ProductName varchar(100),    ProductAmount int ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(ProductName, ProductAmount) values('Product-1', 60); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(ProductName, ProductAmount) values('Product-2', 40); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(ProductName, ProductAmount) values('Product-3', 75); Query OK, 1 row affected (0.15 sec) mysql> ... Read More

How to enable JavaScript in Internet Explorer (IE)?

radhakrishna
Updated on 30-Sep-2019 07:53:07

360 Views

To enable JavaScript in Internet Explorer (IE), follow the below-given steps:Click the gear icon on the right-hand side:Now, a dialog box will open. Go to Security tab and click Custom level.After reaching the Security Settings, go to Scripting, then Active Scripting.Click Enable to enable JavaScript and press Ok.Now, JavaScript will enable after clicking Ok.

How to compare the first date and the last date from a MySQL column with date records?

AmitDiwan
Updated on 30-Sep-2019 07:49:45

211 Views

To compare the first date with the last date, use TIME_TO_SEC() along with MAX() and MIN(). Let us first create a table −mysql> create table DemoTable (    UserName varchar(100),    UserPostDatetime datetime ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Adam', '2019-08-24 11:10:00'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('Adam', '2019-08-24 11:20:00'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('Adam', '2019-08-24 11:50:00'); Query OK, 1 row affected (0.13 sec)Display all records from the table using select statement −mysql> ... Read More

How to get multiple rows in a single MySQL query?

AmitDiwan
Updated on 30-Sep-2019 07:48:08

513 Views

Let us first create a table −mysql> create table DemoTable (    Id int,    Name varchar(100) ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100, 'Chris'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(110, 'David'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(120, 'Robert'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values(130, 'Mike'); Query OK, 1 row affected (0.13 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the ... Read More

Advertisements