AmitDiwan has Published 10744 Articles

Select the maximum for each value in a MySQL table?

AmitDiwan

AmitDiwan

Updated on 18-Dec-2019 05:03:19

209 Views

For this, use GROUP BY clause along with MAX(). Let us first create a table −mysql> create table DemoTable    -> (    -> CountryName varchar(20),    -> Population int    -> ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert ... Read More

Does grant on *.* apply to databases created after the grant in MySQL?

AmitDiwan

AmitDiwan

Updated on 18-Dec-2019 05:00:47

136 Views

Yes, since this is a global privilege. Let us first create a user −mysql> CREATE USER 'Jace'@'localhost' IDENTIFIED BY 'Jace123'; Query OK, 0 rows affected (0.67 sec)Here is the query to grant for global privileges with *.*:mysql> GRANT SELECT ON *.* TO 'Jace'@'localhost'; Query OK, 0 rows affected (0.58 sec)Now ... Read More

JavaScript symbol.description property

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 11:03:49

108 Views

The symbol.description property in JavaScript converts a Symbol object to a primitive value. The syntax is as follows −Symbol()[Symbol.toPrimitive](hint);Example Live Demo Demo Heading Click to display... Result    function display() {       const val = Symbol('john');       console.log(val[Symbol.toPrimitive]);    } OutputClick ... Read More

JavaScript Array.prototype.values()

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 10:58:48

184 Views

The array.values() method of JavaScript returns a new Array Iterator object that contains the values for each index in the array.The syntax is as follows −arr.values()Let us now implement the array.values() method in JavaScript −Example Live Demo Demo Heading Click the button to display the value... Result ... Read More

JavaScript toLocaleString() function

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 10:55:12

262 Views

The toLocaleString() method of JavaScript is used to convert a Date object to a string using locale settings.The syntax is as follows −Date.toLocaleString(locales, options)Above, the locales parameter is the language specific format to be used −ar-SA Arabic (Saudi Arabia) bn-BD Bangla (Bangladesh) bn-IN Bangla (India) cs-CZ Czech (Czech Republic) da-DK ... Read More

JavaScript Array.splice() Method

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 10:50:17

220 Views

The splice() method of JavaScript is used to add or remove item. It returns the removed item.The syntax is as follows −array.splice(index, num, item1, ....., itemX)Here, index is the integer specifying at what position to add or remove items, num is the number of items to remove, item1…itemX are the ... Read More

JavaScript Array.prototype.map() function

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 10:44:09

138 Views

The Array.prototype.map() function of JavaScript is used create a new array with the results of called function.The syntax is as follows −arr.map(function callback(currentValue[, index[, array]])Let us now implement the Array.prototype.map() method in JavaScript −Example Live Demo Demo Heading Click to display the abs() result... Result    function ... Read More

JavaScript Array.of() function

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 09:32:53

124 Views

The Array.of() method of JavaScript is used to create a new array instance with variables as parameter values.The syntax is as follows −Array.of(elements....)Above, elements are the values as parameter values.Let us now implement the Array.of() method in JavaScript −Example Live Demo    Demo Heading    Click the button ... Read More

JavaScript array.keys()

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 09:16:57

266 Views

The array.keys() method of JavaScript is used to return an Array Iterator object with the keys of an array.The syntax is as follows − array.keys()Let us now implement the array.keys() method in JavaScript −Example Live Demo    Car Variants               var arrStud ... Read More

JavaScript Array.isArray()

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 08:37:40

243 Views

The Array.isArray() method of JavaScript is used to determine whether an object is an array or not.The syntax is as follows −Array.isArray(ob)Above, the ob parameter is the object to be tested.Let us now implement the Array.isArray() method in JavaScript −Example Live Demo    Ranking Points    Is this ... Read More

Advertisements