AmitDiwan has Published 10740 Articles

JavaScript array.flatMap()

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 08:25:08

305 Views

The array.flatMap() method of JavaScript is used to flatten the input array element into a new array.The syntax is as follows − array.flatMap(function callback(current_value, index, Array))Let us now implement the array.flatMap() method in JavaScript −Example Live Demo    Ranking Points    Is any point equal to 550 from ... Read More

JavaScript array.entries() Method

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 08:18:02

176 Views

The array.entries() method of JavaScript is used to return an Array Iterator object with key/value pairs.The syntax is as follows − array.entries()Let us now implement the array.entries() method in JavaScript −Example Live Demo    Ranking Points    Is any point equal to 550 from the key-value pairs...   ... Read More

MySQL query to sort by both timestamp and enum?

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 08:06:34

145 Views

For this, you can use ORDER BY DATE(). Let us first create a table. Here, we have a column with type DATE and another with type ENUM −mysql> create table DemoTable    -> (    -> JoiningDate date,    -> Status ENUM('Good', 'Excellent', 'Bad')    -> ); Query OK, 0 ... Read More

Display only date from timestamp value in MySQL

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 08:01:13

247 Views

To display the only date from timestamp value, use the FROM_UNIXTIME() method in MySQL. Let us first create a table −mysql> create table DemoTable    -> (    -> timestampValue bigint    -> ); Query OK, 0 rows affected (0.70 sec)Insert some records in the table using insert command −mysql> ... Read More

How to use a select statement while updating in MySQL?

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 07:58:32

397 Views

For this, use sub query along with WHERE clause while using the MySQL UPDATE command. Let us first create a table −mysql> create table DemoTable    -> (    -> Id int,    -> Name varchar(20)    -> ); Query OK, 0 rows affected (0.82 sec)Insert some records in the ... Read More

Query results that have less than X characters in MySQL?

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 07:54:29

224 Views

You can use CHAR_LENGTH() along with the WHERE clause. Let us first create a table −mysql> create table DemoTable    -> (    -> FullName varchar(50)    -> ); Query OK, 0 rows affected (1.75 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris Brown'); ... Read More

How to split a column in MySQL?

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 07:53:04

2K+ Views

To split a column, you need to use SUBSTRING_INDEX() in MySQL. Let us first create a table −mysql> create table DemoTable    -> (    -> Name varchar(40)    -> ); Query OK, 0 rows affected (1.80 sec)Insert some records in the table using insert command −mysql> insert into DemoTable ... Read More

Add a single year to all the date records in a MySQL table column

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 07:49:36

241 Views

Let us first create a table −mysql> create table DemoTable    -> (    -> JoiningDate datetime    -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2015-01-21'); Query OK, 1 row affected (0.15 sec) mysql> insert into ... Read More

Placing comments in the middle of a create table statement? Is it possible?

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 07:44:06

128 Views

Yes, it is possible using the # symbol. Let us first create a table −mysql> create table DemoTable    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY , # Creating a sequence Number    -> FirstName varchar(20), # Creating a column to store name    -> Age ... Read More

MySQL update multiple records in a single query?

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 07:42:13

936 Views

Let us first create a table −mysql> create table DemoTable    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Marks1 int,    -> Marks2 int,    -> Marks3 int    -> ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using ... Read More

Advertisements