
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
1K+ Views
To trim all strings in an array in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Array with leading and trailing whitespaces... Value = John Value = Jacob Value = Tom Value = Tim Updated Array... Value = John Value = Jacob Value = Tom Value = ... Read More

AmitDiwan
3K+ Views
To sort an array of dates in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Array ( [0] => 2019-08-10 [1] => 2019-09-08 [2] => 2019-10-10 [3] => 2019-11-11 )ExampleLet us now see another example − Live DemoOutputThis will produce the following output−Array ( ... Read More

AmitDiwan
775 Views
To re-index an array in PHP, the code is as follows −Example Live DemoOutputThis will produce the following output−Array... Key = 0, Value = 150 Key = 1, Value = 100 Key = 2, Value = 120 Key = 3, Value = 110 Key = 4, Value = 115 Array after ... Read More

AmitDiwan
1K+ Views
For this, you can use group_concat() with aggregate function. Let us first create a table −mysql> create table DemoTable1869 ( Id int, Subject varchar(20 ), Name varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table ... Read More

AmitDiwan
427 Views
For this, you can use the concept of user defined variable. Let us first create a table −mysql> create table DemoTable1868 ( Value int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1868 ... Read More

AmitDiwan
304 Views
To list all variables initialized by SET operator, the syntax is as follows −select * from performance_schema.user_variables_by_thread;Here is the query to set the variable −mysql> set @FirstName='John'; Query OK, 0 rows affected (0.00 sec) mysql> set @LastName='Doe'; Query OK, 0 rows affected (0.00 sec)Here is the query to display the ... Read More

AmitDiwan
563 Views
For this, use date_add() with interval command. Let us first create a table −mysql> create table DemoTable1867 ( ArrivalTime datetime ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1867 values('2019-10-12 12:34:45'); Query OK, ... Read More

AmitDiwan
298 Views
For this, use FIND_IN_SET(). Let us first create a table −mysql> create table DemoTable1866 ( Value1 int, ListOfValues varchar(100) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1866 values(56, '78, 56, ... Read More

AmitDiwan
516 Views
To round, use MySQL ROUND() function. Let us first create a table −mysql> create table DemoTable1865 ( Value1 int, Value2 int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1865 values(40, ... Read More

AmitDiwan
1K+ Views
Use @anyVariableName to assign the result of a query into a variable. Let us first create a table −mysql> create table DemoTable1864 ( Id int, FirstName varchar(20), LastName varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in ... Read More