AmitDiwan has Published 10740 Articles

HTML onresize Event Attribute

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:26:46

142 Views

The HTML onresize attribute is triggered when user resize the browser window.SyntaxFollowing is the syntax −Let us see an example of HTML onresize event Attribute −Example Live Demo    body {       color: #000;       height: 100vh;       background: linear-gradient(62deg, #FBAB7E 0%, ... Read More

Insert multiple rows from another table but the inserted records should be distinct

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:24:07

304 Views

For this, you can use DISTINCT along with the INSERT INTO SELECT statement. Let us first create a table −mysql> create table DemoTable1 (    Value int ); Query OK, 0 rows affected (1.03 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(50); Query OK, ... Read More

HTML onpaste Event Attribute

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:22:51

265 Views

The HTML onpaste attribute is triggered when user paste some content in an HTML element in an HTML document.SyntaxFollowing is the syntax −Let us see an example of HTML onpaste event Attribute −Example Live Demo    body {       color: #000;       height: 100vh; ... Read More

Limit the count using GROUP BY in MySQL

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:20:43

1K+ Views

Let us first create a table −mysql> create table DemoTable (    UserId int,    UserMessage varchar(100) ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(1, 'Hi'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable ... Read More

How to get MySQL query result in same order as given by IN clause?

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:18:18

1K+ Views

For this, you can use IN() along with ORDER BY FIELD(). Let us first create a table −mysql> create table DemoTable (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    FirstName varchar(100) ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> ... Read More

How to display all the MySQL tables in one line?

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:15:49

582 Views

Use information_schema.tables to display all the tables. With that, se the database name as well, so that you can display tables only from a specific database.Let us now display all the tables in the database “web” −mysql> select group_concat(table_name) from information_schema.tables where table_schema='web';This will produce the following output −+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ... Read More

How to select all the characters after the first 20 characters from a column in MySQL?

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:11:59

275 Views

Let us first create a table −mysql> create table DemoTable (    Title text ); Query OK, 0 rows affected (0.86 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('C is a good programming language to start'); Query OK, 1 row affected (0.18 sec) mysql> ... Read More

MySQL query to find single value from duplicates with certain condition by excluding other records using NOT IN

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:08:35

104 Views

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

Underscore as a table name in MySQL is possible?

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:05:44

270 Views

Yes, we can add underscore as a table name using backticks around the table name. Following is the syntax −INSERT INTO `yourTableName` values(yourValue1, .......N);Let us first create a table −mysql> create table `DemoTable_1` (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Location varchar(100) ); Query OK, 0 rows ... Read More

Delete records from a MySQL table by excluding non-deleted records using NOT IN

AmitDiwan

AmitDiwan

Updated on 26-Sep-2019 07:03:44

204 Views

Let us first create a table −mysql> create table DemoTable (    FirstName varchar(100) ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('Robert'); Query OK, 1 ... Read More

Advertisements