Smita Kapse has Published 498 Articles

How to delete n-th element of array in MongoDB?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

334 Views

You can use $unset as well as $pull operator with an update to delete the nth element of an array.Let us create a collection with a document. The query to create a collection with a document is as follows −> db.getNThElementDemo.insertOne({"UserName":"John", "UserAge":23, "ListOfFriends":["Carol", "Sam", "Mike", "Bob"]}); {    "acknowledged" : ... Read More

Merge two tables with union in MySQL?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

663 Views

To merge two tables with UNION, you can use create table select statement. Following is the syntax −create table yourNewTableName select * from yourFirstTableName UNION select * from yourSecondTableName;Let us first create a table. Following is the query −mysql> create table FirstTable    -> (    -> Id int,   ... Read More

How to change current country code in android?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

823 Views

This example demonstrate about How to change current country code in android.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     In the ... Read More

Can we enforce compound uniqueness in MySQL?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

67 Views

Yes, we can do that. To understand, let us first create a table −mysql> create table enforceCompoundUniqueness    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(40) NOT NULL,    -> StudentMobileNumber varchar(12) NOT NULL,    -> UNIQUE StudentName_StudentMobileNumber(StudentName, StudentMobileNumber)    -> ); Query ... Read More

How to query for records where field is null or not set in MongoDB?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

764 Views

Let us work around two cases −Case 1 − The syntax is as follows when the field is present and set to null.db.yourCollectionName.count({yourFieldName: null});Case 1 − The syntax is as follows when the field is not present and not set.db.yourCollectionName.count({yourFieldName: {$exists: false}});To understand both the above syntaxes, let us create ... Read More

How to use endsWith () in Android textview?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

292 Views

This example demonstrate about How to use endsWith () in Android textview.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         ... Read More

While developing an iOS application you might have got a scenario where you require to send a text message and you would be baffling around with Why? How? And What?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

153 Views

In this tutorial we will be focussing on how to send text message from your iOS application in Swift, where we will be sending a text message from your user’s phone number. While we cannot do this directly without the content of your user’s but we can display a precomposed ... Read More

How does MongoDB order their docs in one collection?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

81 Views

MongoDB order the docs in one collection with the help of a $natural operator. It stores the document as it is when we get from find(). The default order is $natural. Let us now see the syntax −db.yourCollectionName.find().sort({ "$natural": 1 });To understand the above syntax, let us create a collection ... Read More

How to write MySQL procedure to insert data into a table?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

699 Views

To write stored procedure to insert data into a table, at first you need to create a table −mysql> create table insertDataUsingStoredProcedure    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY ,    -> Name varchar(20),    -> Age int    -> ); Query OK, 0 rows ... Read More

How to use equalsIgnoreCase () in Android textview?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:25

464 Views

This example demonstrate about How to use equalsIgnoreCase () in Android textview.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         ... Read More

Advertisements