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
568 Views
For this, use MySQL YEAR() function. Let us first create a table −mysql> create table DemoTable1843 ( StartDate date, EndDate date ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1843 values('2019-01-21', ... Read More
 
							AmitDiwan
498 Views
To multiply with NULL row, you can use COALESCE(). Let us first create a table −mysql> create table DemoTable1842 ( NumberOfItems int, Amount int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert ... Read More
 
							AmitDiwan
157 Views
For this, you can use WHERE clause along with subquery. Let us first create a table −mysql> create table DemoTable1840 ( UserName varchar(20), UserType ENUM('GUEST', 'ADMIN') ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command ... Read More
 
							AmitDiwan
235 Views
The syntax for the fastest way is given below. Here, we have used INSERT INTO just once and formed an optimized way −insert into yourTableName values(NULL, yourValue1', yourValue2), (NULL, yourValue1', yourValue2), ....N;Let us first create a table −mysql> create table DemoTable1839 ( ClientId int NOT NULL ... Read More
 
							AmitDiwan
262 Views
To check substring in a string, the code is as follows in PHP −Example Live DemoOutputThis will produce the following output−String = How I Met Your Mother Substring = Mother Substring found successfullyExampleLet us now see another example − Live DemoOutputThis will produce the following output−String = In the Heart of Sea ... Read More
 
							AmitDiwan
3K+ Views
To add days to $Date in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Displaying date... Date = 2019-11-11 Displaying updated date... 2019-12-01ExampleLet us now see another example − Live DemoOutputThis will produce the following output−Displaying Date...2019/11/11 Displaying Updated Date... 2019/12/06
 
							AmitDiwan
773 Views
To convert string to boolean in PHP, the code is as follows. Use the filter_val() method−Example Live DemoOutputThis will produce the following output−Displaying Sunday as first day of a week... First day (next week) = Sunday - 15/12/2019 bool(false)ExampleLet us now see another example − Live DemoOutputThis will produce the following output−bool(false) ... Read More
 
							AmitDiwan
2K+ Views
To get the first day of the week in PHP, the code is as follows −Example Live DemoOutputThis will produce the following output −First day = Monday - 09/12/2019ExampleLet us now see another example − Live DemoOutputThis will produce the following output −Displaying Sunday as first day of a week... First day ... Read More
 
							AmitDiwan
310 Views
To get the first element of an array in PHP, the code is as follows −Example Live DemoOutputThis will produce the following output−Array value ... Value 1 = 150ExampleLet us now see another example − Live DemoOutputThis will produce the following output −Value 1 = 150
 
							AmitDiwan
405 Views
To get random value out of an array in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output −Array values ... Value 1 = 150 Value 2 = 100 Value 3 = 120 Value 4 = 110 Value 5 = 115 Value 6 = 103 Value 7 ... Read More