
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
145 Views
Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, ClientName varchar(100), ClientAge int ); Query OK, 0 rows affected (0.92 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(ClientName, ClientAge) values('Robert', 45); Query OK, ... Read More

AmitDiwan
732 Views
To fetch the 2nd highest value, use ORDER BY DESC with LIMIT 1, 1. Let us first create a table −mysql> create table DemoTable ( StudentScore int ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(89); Query ... Read More

AmitDiwan
95 Views
For this, use IS NULL property. Let us first create a table −mysql> create table DemoTable ( EmployeeName varchar(100), EmployeeAge int ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', 32); Query OK, 1 row affected ... Read More

AmitDiwan
121 Views
We will see an example and create a table wherein we have set StudentId column as AUTO_INCREMENT = 100 and used ZEROFILL as well −mysql> create table DemoTable ( StudentId int(7) ZEROFILL NOT NULL AUTO_INCREMENT, PRIMARY KEY(StudentId) )AUTO_INCREMENT=100; Query OK, 0 rows affected (0.48 sec)Insert some records in ... Read More

AmitDiwan
155 Views
Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, PlayerName varchar(100), PlayerScore int ); Query OK, 0 rows affected (0.97 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(PlayerName, PlayerScore) values('Chris', 780); Query OK, ... Read More

AmitDiwan
512 Views
To format, use DATE_FORMAT(). Let us first create a tablemysql> create table DemoTable ( LoginTime time ); Query OK, 0 rows affected (0.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('13:10'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable values('20:08'); ... Read More

AmitDiwan
689 Views
To remove only the first word from column values, use substring(). Following is the syntax −select substring(yourColumnName, locate(' ', yourColumnName)+1) AS anyAliasName from yourTableName;Let us first create a table −mysql> create table DemoTable ( Title text ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table ... Read More

AmitDiwan
137 Views
Let’s say the stored price is inclusive of 20% sales tax. Now, let us first create a table −mysql> create table DemoTable ( Price int ); Query OK, 0 rows affected (1.09 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(20); Query OK, 1 ... Read More

AmitDiwan
463 Views
Stream method of array class introduced in Java 8. Let us see an example wherein we are counting empty strings, eliminating empty strings, getting a list of square of distinct numbers, displaying random numbers, etc −Exampleimport java.util.ArrayList; import java.util.Arrays; import java.util.IntSummaryStatistics; import java.util.List; import java.util.Random; import java.util.stream.Collectors; import java.util.Map; public ... Read More

AmitDiwan
962 Views
Let’s say the following is our Iterator with Integer values −Iteratoriterator = Arrays.asList(20, 40, 60, 80, 100, 120, 150, 200).iterator();Now, convert the Iterator to Iterable −Iterableiterable = StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false).collect(Collectors.toList());ExampleFollowing is the program to convert Iterator to Iterable in Java −import java.util.*; import java.util.stream.Collectors; import java.util.stream.StreamSupport; public class Demo { ... Read More