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 access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.This example demonstrate about How to show records in descending order Android sqlite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details ... Read More
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 access this database, you don't need to establish any kind of connections for it like JDBC, ODBC etc.This example demonstrate about How to use rtrim () in Android sqliteStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to ... Read More
This object is an actual reference to the instance of the page. It can be thought of as an object that represents the entire JSP page.The page object is really a direct synonym for the this object.
SQL's use of NULL values and Java's use of null are different concepts. So, to handle SQL NULL values in Java, there are three tactics you can use:Avoid using getXXX( ) methods that return primitive data types.Use wrapper classes for primitive data types, and use the ResultSet object's wasNull( ) method to test whether the wrapper class variable that received the value returned by the getXXX( ) method should be set to null.Use primitive data types and the ResultSet object's wasNull( ) method to test whether the primitive variable that received the value returned by the getXXX( ) method should ... Read More
To set Ennead value in Java, you need to use the setAtX() method. Here, X represents the index wherein you need to set the value i.e. for index 1, use setAt1() method. Set the value as the parameter value of the method.Let us first see what we need to work with JavaTuples. To work with Ennead class in JavaTuples, you need to import the following packageimport org.javatuples.Ennead;Note Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project -> Properties -> Java Build Path -> Add External Jars and upload the downloaded JavaTuples ... Read More
To fix this error, you need to specify the -p option for password.The syntax is as followsmysql -uyourUserName -pLet us implement it.First, we need to open CMD using Windows+R shortcut keys. The snapshot is as followsType CMD and press OK button. You will get a command prompt.The snapshot is as followsNow reach the MySQL bin directory.The snapshot is as followsNow use the syntax discussed in the beginning.The command is as follows
To retrieve a value from MongoDB by its key name, use the following syntax −db.yourCollectionName.find({}, {"yourFieldName":1}).pretty();To understand the above syntax, let us create a collection with the document. The query to create a collection with a document is as follows −> db.retrieveValueFromAKeyDemo.insertOne({"CustomerName":"Larry", "CustomerAge":21, "CustomerCountryName":"US"}); { "acknowledged" : true, "insertedId" : ObjectId("5c9163b5a56efcc0f9e69048") } > db.retrieveValueFromAKeyDemo.insertOne({"CustomerName":"Chris", "CustomerAge":24, "CustomerCountryName":"AUS"}); { "acknowledged" : true, "insertedId" : ObjectId("5c9163c4a56efcc0f9e69049") } > db.retrieveValueFromAKeyDemo.insertOne({"CustomerName":"Mike", "CustomerAge":26, "CustomerCountryName":"UK"}); { "acknowledged" : true, "insertedId" : ObjectId("5c9163d3a56efcc0f9e6904a") }Display all documents from a collection with the help of find() method. The query is as follows −> db.retrieveValueFromAKeyDemo.find().pretty();The ... Read More
For find() to search for nested keys in MongoDB, you can use dot(.) notation. Following is the syntaxdb.yourCollectionName.find({"yourOuterFieldName.yourInnerFieldName":"yourValue"}).pretty();Let us first create a collection with documents:>db.searchForNestedKeysDemo.insertOne({"ClientName":"Larry", "ClientAge":28, "ClientExtra Details":{"isEducated":true, "CountryName":"US"}}); { "acknowledged" : true, "insertedId" : ObjectId("5ca20e8b66324ffac2a7dc64") } >db.searchForNestedKeysDemo.insertOne({"ClientName":"Chris", "ClientAge":29, "ClientExtra Details":{"isEducated":false, "CountryName":"UK"}}); { "acknowledged" : true, "insertedId" : ObjectId("5ca20ea366324ffac2a7dc65") } >db.searchForNestedKeysDemo.insertOne({"ClientName":"David", "ClientAge":39, "ClientExtra Details":{"isEducated":true, "CountryName":"AUS"}}); { "acknowledged" : true, "insertedId" : ObjectId("5ca20eba66324ffac2a7dc66") }Following is the query to display all documents from a collection with the help of find() method> db.searchForNestedKeysDemo.find().pretty();This will produce the following output{ "_id" : ObjectId("5ca20e8b66324ffac2a7dc64"), "ClientName" : "Larry", ... Read More
Let us first create an ArraList and add some elements to it −ArrayList < String > arr = new ArrayList < String > (); arr.add("50"); arr.add("100"); arr.add("150"); arr.add("200"); arr.add("250"); arr.add("300");Now, create a new collection. We are creating Vector here −Vectorvector = new Vector(); vector.add("500"); vector.add("700"); vector.add("800"); vector.add("1000");Now, we will append all the elements of the above Vector to our ArrayList beginning from index 3 −arr.addAll(3, vector);Example Live Demoimport java.util.ArrayList; import java.util.Vector; public class Demo { public static void main(String[] args) { ArrayListarr = new ArrayList(); arr.add("50"); arr.add("100"); arr.add("150"); ... Read More
You can use ALTER command to convert Integer into Varchar. Let us first create a tablemysql> create table DemoTable ( UserId int, UserFirstName varchar(20), UserLastName varchar(20), UserAge int ); Query OK, 0 rows affected (0.73 sec)Now check the description of table using DESC command:mysql> desc DemoTable;This will produce the following output −+---------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+-------+ | UserId | int(11) | YES | | NULL | ... Read More