Nishtha Thakur

Nishtha Thakur

398 Articles Published

Articles by Nishtha Thakur

Page 32 of 40

MySQL Select when a grouped record has multiple matching strings?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 133 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 DemoTable(ProductName) values('Product-1'); Query OK, 1 row affected (0.05 sec) mysql> insert into DemoTable(ProductName) values('Product2'); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable(ProductName) values('Product1'); Query OK, 1 row affected (0.04 sec) mysql> insert into DemoTable(ProductName) values('Product-3'); Query OK, 1 row affected (0.05 sec) mysql> ...

Read More

Fetch data between two rows in MySQL?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 485 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 command −mysql> insert into DemoTable(Name) values('Larry'); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable(Name) values('Robert'); Query OK, 1 row affected (0.05 sec) mysql> insert into DemoTable(Name) values('Chris'); Query OK, 1 row affected (0.05 sec) mysql> insert into DemoTable(Name) values('David'); Query OK, 1 row affected ...

Read More

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

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 648 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 DemoTable(Value) values('101'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(Value) values('P'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable(Value) values('A'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable(Value) values('53'); Query OK, 1 row affected (0.13 sec) mysql> ...

Read More

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

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 230 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 −+---------------------------------------------+--------------------------------+ | TABLE_NAME                                  | COLUMN_NAME                    | +---------------------------------------------+--------------------------------+ | COLUMNS                                     ...

Read More

Java DatabaseMetaData getMaxIndexLength() method with example.

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 123 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 no limit or, limit is unknown.To get the DatabaseMetaData object −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager ...

Read More

How to get MySQL combined field result?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 184 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 insert command −mysql> insert into DemoTable(ClientFirstName, ClientLastName) values('John', 'Smith'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable(ClientFirstName, ClientLastName) values('John', 'Miller'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(ClientFirstName, ClientLastName) values('Carol', 'Taylor'); Query OK, 1 row affected (0.13 sec) mysql> insert into ...

Read More

How to work with border layout position options in Java?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 369 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) {       JPanel panel = new JPanel(new BorderLayout());       JToolBar toolbar = new JToolBar();       panel.add(toolbar, BorderLayout.PAGE_START);       toolbar.add(new JTextArea(" Add name here"));       toolbar.add(new JButton("Submit Name"));       toolbar.addSeparator();       toolbar.add(new JTextArea(" Add age here"));     ...

Read More

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

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 218 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 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 filter data using where Clause and “GLOB” in Android sqlite.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill ...

Read More

How to use INTERSECT operator in Android sqlite?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 193 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 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 INTERSECT operator in Android sqliteStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to ...

Read More

How to create Decade Tuple in Java?

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 121 Views

Create Decade Tuple in Java using a constructor or with() method. Here, we will see how to create a Decade of Tuple using constructor.Let us first see what we need to work with JavaTuples. To work with Decade class in JavaTuples, you need to import the following package −import org.javatuples.Decade;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 jar file. Refer the below guide for all the steps to run JavaTuples −Steps − How ...

Read More
Showing 311–320 of 398 articles
« Prev 1 30 31 32 33 34 40 Next »
Advertisements