AmitDiwan has Published 10744 Articles

HTML Location assign( ) Method

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 11:08:20

164 Views

The HTML Location assign() method loads a new HTML document without replacing the URL of the current HTML document from the document history.SyntaxFollowing is the syntax −location.assign(URL)Let us see an example of HTML Location assign() Method−Example Live Demo    body {       color: #000;       ... Read More

Get all the tables from a MySQL database having a specific column, let’s say xyz?

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 08:00:45

247 Views

Let’s say we have a database “web” and we need to get all the tables having a specific column ’StudentFirstName’.For this, below is the query −mysql> select myColumnName.table_name from information_schema.columns myColumnName where myColumnName.column_name = 'StudentFirstName' and table_schema='web';This will produce the following output −+---------------+ | TABLE_NAME | +---------------+ ... Read More

Convert MySQL timestamp to UNIX Timestamp?

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 07:58:58

1K+ Views

To convert MySQL timestamp to UNIX Timestamp, use the UNIX_TIMESTAMP(). Following is the syntax −select unix_timestamp(yourColumnName) from yourTableName;Let us first create a table −mysql> create table DemoTable(    Duetimestamp timestamp ); Query OK, 0 rows affected (2.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable ... Read More

How can I replace & with an ampersand in my MySQL database?

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 07:57:41

747 Views

To replace & with an ampersand, use MySQL REPLACE(). Let us first create a table −mysql> create table DemoTable(    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Value varchar(100) ); Query OK, 0 rows affected (1.06 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Value) ... Read More

Find average on the basis of corresponding duplicate VARCHAR values in MySQL

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 07:56:21

91 Views

Let us first create a table −mysql> create table DemoTable(    Value int,    Value2 varchar(100) ); Query OK, 0 rows affected (0.84 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10, '999.999.999.999'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values(20, ... Read More

Can we perform MySQL UPDATE and change nothing in a table?

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 07:55:11

353 Views

Yes, we can do that. Let us first create a table −mysql> create table DemoTable(    Id int ); Query OK, 0 rows affected (1.02 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(201); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable ... Read More

What does select @@identity do in MySQL?

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 07:53:46

2K+ Views

The @@identity returns the last inserted value in the auto_increment column in the current session. Let us first create a table −mysql> create table DemoTable(    UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    UserName varchar(100) ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using ... Read More

MySQL query to fetch the maximum corresponding value from duplicate column values

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 07:52:33

194 Views

Let us first create a table −mysql> create table DemoTable(    ProductName varchar(100),    ProductPrice int ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Product-1', 56); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Product-2', ... Read More

Will extending the size of a varchar field in MySQL affect the data inside it?

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 07:50:35

451 Views

If you will extend the size of a varchar field in MySQL then it won’t affect the data inside it.Let us first create a table −mysql> create table DemoTable(    Name varchar(8) ); Query OK, 0 rows affected (1.11 sec)Insert some records in the table using insert command −mysql> insert ... Read More

Sort a list in MySQL and display a fixed result at the end of the column?

AmitDiwan

AmitDiwan

Updated on 27-Sep-2019 07:48:52

104 Views

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

Advertisements