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 10740 Articles
AmitDiwan
134 Views
For this, you can use CHAR_LENGTH(). Use RAND() for random records. Let us first create a table −mysql> create table DemoTable (Subject text); Query OK, 0 rows affected (0.61 sec)ExampleInsert some records in the table using insert command −mysql> insert into DemoTable values('C'); Query OK, 1 row affected (0.16 sec) ... Read More
AmitDiwan
198 Views
To sort dates given in the form of an array in PHP, the code is as follows −Example Live DemoOutputThe dates in sorted order is Array ( [0] => 2090-12-06 [1] => 2020-09-23 [2] => 2002-09-11 [3] => 2009-30-11 )A function named ‘compare_dates’ takes two time formats ... Read More
AmitDiwan
290 Views
To compare two dates in PHP, the code is as follows −Example Live DemoOutput2020-11-22 is later than 2011-11-22Two dates of ‘DateTime’ format are generated and checked to see which one is sooner or later. If the first date is later, relevant message is printed on the console. Otherwise, a message indicating ... Read More
AmitDiwan
661 Views
To find number of days in every week between two given date ranges in PHP, the code is as follows −Example Live DemoOutputThe number of days between the given range isArray ( [Monday] => 5 [Tuesday] => 5 [Wednesday] => 5 [Thursday] => 5 [Friday] => ... Read More
AmitDiwan
234 Views
The ‘date_diff’ function can be used to get the difference between two dates. It is a built-in function that returns a DateInterval object if a specific number of days has been found, and returns False if the days is not found.Example Live DemoOutputThe day difference is: +60 daysTwo dates are defined ... Read More
AmitDiwan
482 Views
To print continuous character pattern triangle in PHP, the code is as follows −Example Live DemoOutputA B C D E F G H I J K L M N O P Q R S T UThis is similar to generating a star or a number pattern, the only difference being, continuous ... Read More
AmitDiwan
325 Views
To print continuous numbers in the form of triangle in PHP, the code is as follows −Elements Live DemoOutput1 2 3 4 5 6 7 8 9 10This is similar to generating a star or a number pattern, the only difference being, continuous numbers are generated instead of stars or repeated ... Read More
AmitDiwan
2K+ Views
To print the number pattern in PHP, the code is as follows −Example Live DemoOutput1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6This is similar to generating a star pattern, the only difference being, numbers are generated instead of ... Read More
AmitDiwan
2K+ Views
Let us see an example to print a pattern of pyramid in PHP −Example Live DemoOutput * * * * * * * * * * * * * * * * * * ... Read More
AmitDiwan
443 Views
Use index to select top n rows efficiently. Let us first create a table −mysql> create table DemoTable (StudentName varchar(100), StudentScore int ); Query OK, 0 rows affected (0.66 sec)ExampleInsert some records in the table using insert command −mysql> insert into DemoTable values('John', 34); Query OK, 1 row affected (0.19 ... Read More