
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
Anvi Jain has Published 569 Articles

Anvi Jain
192 Views
To query array of nested string, you can use the dot(.) notation. Let us first create a collection with documents −> db.nestedStringDemo.insertOne( { "CustomerName": "John", "CustomerOtherDetails": [ { "Age":29, "CountryName": "US" }, { "CompanyName": "Amazon", "Salary": 150000, ... Read More

Anvi Jain
835 Views
You can use aggregate function SUM() for this. Let us first create a table −mysql> create table DemoTable ( CustomerId int NOT NULL AUTO_INCREMENT PRIMARY KEY, CustomerProductName varchar(100), CustomerProductQuantity int, CustomerPrice int ); Query OK, 0 rows affected (0.17 sec)Insert some records in the ... Read More

Anvi Jain
188 Views
The getMaxColumnNameLength() method of the DatabaseMetaData interface is used to find out the maximum number of characters that the underlying database allows in the name of a column.This method returns an integer value, representing the maximum number of characters allowed in a column name. If this value is 0 it ... Read More

Anvi Jain
214 Views
The SOUNDEX() returns a soundex string. Two strings that sound almost the same should have identical soundex stringsTo query soundex() in MySQL, you can use the below syntax −select *from yourTableName where soundex(yourValue)=soundex(yourColumnName);Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT ... Read More

Anvi Jain
220 Views
To get distinct first word from a string, you can use distinct(). Let us first create a collection with documents −> db.distinctFirstWordDemo.insertOne( { "_id": 100, "StudentName":"John", "StudentFeature": "John is a good player", "Subject":"MongoDB" } ); { ... Read More

Anvi Jain
59 Views
The getMaxUserNameLength() method of the DatabaseMetaData interface is used to find out the maximum number of characters that the underlying database allows in the name of a user.This method returns an integer value, representing the maximum number of characters allowed in a user name. If this value is 0 it indicates ... Read More

Anvi Jain
107 Views
To order string as a number, use CAST(). Following is the syntax −select *from yourTableName ORDER BY CAST(yourColumnName AS SIGNED) DESC;Let us first create a table −mysql> create table DemoTable ( Id varchar(100) ); Query OK, 0 rows affected (0.18 sec)Insert some records in the table using ... Read More

Anvi Jain
373 Views
To sum based on field values, use aggregate function SUM() along with CASE statement. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Price int, isValidCustomer boolean, FinalPrice int ); Query OK, 0 rows affected ... Read More

Anvi Jain
56 Views
The getMaxColumnsInSelect() method of the DatabaseMetaData interface is used to find out the maximum number of columns that the underlying database allows in a SELECT list.This method returns an integer value, representing the maximum number of columns allowed in a SELECT list. If this value is 0 it indicates that ... Read More

Anvi Jain
545 Views
Use DATE_FORMAT for this. Let us first create a table −mysql> create table DemoTable ( ShippingDate varchar(200) ); Query OK, 0 rows affected (0.25 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('04:58 PM 10/31/2018'); Query OK, 1 row affected (0.10 ... Read More