- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 629 Articles
Anvi Jain
126 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
581 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
99 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
164 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
133 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
18 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
72 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
300 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
18 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
393 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