Nishtha Thakur has Published 387 Articles

How to use OR Conjunctive Operators in Android sqlite?

Nishtha Thakur

Nishtha Thakur

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

162 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

How to stop MongoDB in a single command?

Nishtha Thakur

Nishtha Thakur

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

702 Views

In order to stop MongoDB in a single command, use the following syntax −mongo --eval "db.getSiblingDB('admin').shutdownServer()"Let us implement the above syntax in order to stop MongoDB in one command.First, use the shortcut key −Ctrl + C;The query is as follows −C:\Program Files\MongoDB\Server\4.0\bin>mongo --eval "db.getSiblingDB('admin').shutdownServer()"The following is the output − displaying ... Read More

How to form a composite key to be unique in MySQL?

Nishtha Thakur

Nishtha Thakur

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

2K+ Views

To form a composite key to be unique, you need to use ADD UNIQUE command. Following is the syntax −alter table yourTableName add unique yourUniqueName( yourColumnName1, yourColumnName2, .......N);Let us first create a table. Following is the query −mysql> create table makeCompositeKeyDemo    -> (    -> Id int NOT NULL ... Read More

Identify last document from MongoDB find() result set?

Nishtha Thakur

Nishtha Thakur

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

252 Views

To identify the last document from MongoDB find() result set, you can use sort() in descending order. The syntax is as follows −db.yourCollectionName.find().sort( { _id : -1 } ).limit(1).pretty();To understand the above syntax, let us create a collection with the document. The query to create a collection with a document ... Read More

How to use Navigable set interface in Android?

Nishtha Thakur

Nishtha Thakur

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

190 Views

This example demonstrates about How to use Navigable set interface in AndroidStep 1 &minus 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

How to use replace command in Android sqlite?

Nishtha Thakur

Nishtha Thakur

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

497 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

How to use charAt() in Android textview?

Nishtha Thakur

Nishtha Thakur

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

483 Views

This example demonstrates about How to use charAt() in Android text view.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

How to use Tree set in Android?

Nishtha Thakur

Nishtha Thakur

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

432 Views

This example demonstrates about How to use Tree set in AndroidStep 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

How to get day of month, day of year and day of week in android using offset date time API class?

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

This example demonstrate about How to get day of month, day of year and day of week in android using offset date time API class.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 ... Read More

Find items that do not have a certain field in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

204 Views

To find items that do not have a certain field, use the $exists operator. The syntax is as follows −> db.yourCollectionName.find({"yourItemName":{$exists:false}}).pretty();To understand the syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.findDocumentDoNotHaveCertainFields.insertOne({"UserId":101, "UserName":"John", "UserAge":21}); {   ... Read More

Advertisements