AmitDiwan has Published 10744 Articles

JavaScript array.includes() function

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 08:32:03

169 Views

The array.includes() method of JavaScript is used to check whether an array contains a specified element.The syntax is as follows −array.includes(ele, start)Above, the parameter ele is the element to search for. The start parameter is the position to begin the search with.Let us now implement the array.includes() method in JavaScript ... Read More

JavaScript array.flatMap()

AmitDiwan

AmitDiwan

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

271 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

156 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

128 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

227 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

351 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

193 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

211 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

99 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

Advertisements