
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
George John has Published 1081 Articles

George John
5K+ Views
To sort by character length in MySQL use the ORDER BY LENGTH(). Let us first create a table:mysql> create table orderingAADemo -> ( -> Value varchar(100) -> ); Query OK, 0 rows affected (1.30 sec)Following is the query to insert some records in the table using insert ... Read More

George John
1K+ Views
To convert bool to int in MySQL, you can use CAST(). Let us first create a table:mysql> create table convertBoolToIntDemo -> ( -> isYoung bool -> ); Query OK, 0 rows affected (0.69 sec)Following is the query to insert some records ... Read More

George John
765 Views
To get total number of fields in all tables in database, you can use information_schema.columns along with aggregate function count(*).We are using ‘sample’ database which consists of a lot of tables with fields. Following is the query to get total number of fields in all tables in database:mysql> SELECT COUNT(*) ... Read More

George John
476 Views
The IntStream class in Java the following two forms of of() methodIntStream of(int t) methodThe following of() method returns a sequential IntStream containing a single element. Here is the syntaxstatic IntStream of(int t)Here, parameter t is the single element.IntStream of(int… values) methodThe following of() method returns a sequentially ordered stream ... Read More

George John
4K+ Views
To change a primary key to auto_increment, you can use MODIFY command. Let us first create a table.mysql> create table changePrimaryKeyInAutoIncrement -> ( -> StudentId int not null primary key, -> StudentName varchar(100), -> StudentAge int, -> StudentAddress varchar(100) -> ); Query OK, 0 ... Read More

George John
490 Views
To increment a value in nested object, you can use $inc operator. Let us first implement the following query to create a collection with documents>db.incrementValueDemo.insertOne({"StudentName":"Larry", "StudentCountryName":"US", "StudentDetails":[{"StudentSubjectName":"Math", "StudentMathMarks":79}]}); { "acknowledged" : true, "insertedId" : ObjectId("5c986ca0330fd0aa0d2fe4a2") }Following is the query to display all documents from a collection with the ... Read More

George John
600 Views
To count value for multiple columns, use the CASE statement. Let us first create a table::mysql> create table countValueMultipleColumnsDemo -> ( -> Value1 int, -> Value2 int, -> Value3 int -> ); Query OK, 0 rows affected (0.62 sec)Following is the query to insert some ... Read More

George John
303 Views
In MySQL, AUTO_INCREMENT=3 tells that the inserted record will start from 3 not the default 1. Let us first create a sample table and set auto increment to 3:mysql> create table Auto_incrementDemo -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(20) -> ... Read More

George John
166 Views
Yes, you can concatenate strings with || in MySQL with the help of sql_mode. Set the sql_mode to PIPES_AS_CONCAT.The syntax is as followsset sql_mode=PIPES_AS_CONCAT;The following is the syntax to concat with the help of ||.SELECT ‘yourValue' || yourColumName AS anyAliasName FROM yourTableName;To understand the above syntax, let us create a ... Read More