Nishtha Thakur has Published 387 Articles

Java DatabaseMetaData getMaxStatementLength() method with example.

Nishtha Thakur

Nishtha Thakur

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

144 Views

The getMaxStatementLength() method of the DatabaseMetaData interface is used to find out the maximum number of characters that the underlying database allows in a single SQL statement.This method returns an integer value, representing the maximum number of characters allowed in an SQL statement. If this value is 0 it indicates ... Read More

MySQL Select when a grouped record has multiple matching strings?

Nishtha Thakur

Nishtha Thakur

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

127 Views

You can use regular expression for this. Let us first create a table −mysql> create table DemoTable    (    ProductId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ProductName varchar(20)    ); Query OK, 0 rows affected (0.19 sec)Insert some records in the table using insert command −mysql> insert into ... Read More

Fetch data between two rows in MySQL?

Nishtha Thakur

Nishtha Thakur

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

477 Views

To fetch data between two rows, use the concept of LIMIT. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Name varchar(10)    ); Query OK, 0 rows affected (0.22 sec)Insert some records in the table using insert ... Read More

How can we sort a query using ORDER BY CASE WHEN REGEXP?

Nishtha Thakur

Nishtha Thakur

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

643 Views

Use regular expression along with CASE statement. Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Value varchar(20)    ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into ... Read More

Set a filter on field type to fetch MySQL columns with type text?

Nishtha Thakur

Nishtha Thakur

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

225 Views

To set a filter for type, you can use below syntax −SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE DATA_TYPE = 'yourDataTypeName';Let us implement the above syntax to show fields only with field type text −mysql> SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE DATA_TYPE = 'text';This will produce the following output −+---------------------------------------------+--------------------------------+ | ... Read More

Java DatabaseMetaData getMaxIndexLength() method with example.

Nishtha Thakur

Nishtha Thakur

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

116 Views

The getMaxIndexLength() method of the DatabaseMetaData interface is used to find out the maximum number of bytes that the underlying database allows for an index.This method returns an integer value, representing the maximum number of byes allowed in an index. If this value is 0 it indicates that there is ... Read More

How to get MySQL combined field result?

Nishtha Thakur

Nishtha Thakur

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

181 Views

You can use CONCAT() function from MySQL for this. Let us first create a table −mysql> create table DemoTable    (    ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ClientFirstName varchar(20),    ClientLastName varchar(20)    ); Query OK, 0 rows affected (0.50 sec)Insert some records in the table using ... Read More

How to work with border layout position options in Java?

Nishtha Thakur

Nishtha Thakur

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

363 Views

Let us see some examples to work with different border layout position options such as PAGE_START, PAGE_END, etc.The following is an example of BorderLayout.PAGE_START option −Examplepackage my; import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JToolBar; public class SwingDemo {    public static void main(String[] args) { ... Read More

Difference between count() and find().count() in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

435 Views

There is no difference between count() and find().count(). Let us see how both of them works. To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.countDemo.insertOne({"UserId":1, "UserName":"John"}); {    "acknowledged" : true,    "insertedId" ... Read More

How to filter data using where Clause and “GLOB” in Android sqlite?

Nishtha Thakur

Nishtha Thakur

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

212 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

Advertisements