- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Smita Kapse has Published 558 Articles
Smita Kapse
15 Views
The getMaxCatalogNameLength() method of the DatabaseMetaData interface is used to find out the maximum number of characters that the underlying database allows in the name of a catalog.This method returns an integer value, representing the maximum number of characters allowed in a catalog name. If this value is 0 it ... Read More
Smita Kapse
493 Views
To select specific rows, use FIND_IN_SET() function in MySQL. Let us first create a table −mysql> create table DemoTable ( ListOfValues varchar(200) ); Query OK, 0 rows affected (0.31 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('112, 114, 567, Java, 345'); ... Read More
Smita Kapse
206 Views
You can achieve this with the help of CAST() function. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Score int ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Score) values(10); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable(Score) values(100); Query OK, 1 row affected (0.14 sec) ... Read More
Smita Kapse
1K+ Views
To list all rows by group, you can use GROUP_CONCAT(). Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(20), Value varchar(100) ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table ... Read More
Smita Kapse
18 Views
The getMaxColumnsInIndex() method of the DatabaseMetaData interface is used to find out the maximum number of columns that the underlying database allows in an index.This method returns an integer value, representing the maximum number of columns allowed in an index. If this value is 0 it indicates that there is ... Read More
Smita Kapse
246 Views
To allow multiple selection of nodes not necessarily contiguous, set the selection mode for tree to be DISCONTIGUOUS_TREE_SELECTION −tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);The following is an example to allow multiple selection of nodes, which are not necessarily contigous −Examplepackage my; import javax.swing.JFrame; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeSelectionModel; public class SwingDemo { public static void main(String[] args) throws Exception { JFrame frame = new JFrame("Demo"); DefaultMutableTreeNode node = new DefaultMutableTreeNode("Products"); ... Read More
Smita Kapse
3K+ Views
First of all, you need to enable innodb_print_all_deadlocks. Following is the syntax −set global innodb_print_all_deadlocks=1;After executing the above statement, let us execute the below syntax in order to display all deadlock logs −show engine innodb status;Let us implement the above syntax −mysql> set global innodb_print_all_deadlocks=1; Query OK, 0 rows affected ... Read More
Smita Kapse
394 Views
To align multiple buttons with different height in Java, try the following example, Here, we have set 5 buttons with GridBagConstraints −GridBagConstraints constraints = new GridBagConstraints(); constraints.insets = new Insets(5, 5, 5, 5); constraints.anchor = GridBagConstraints.WEST;In addition, to set different height for different buttons, we have used −component. getPreferredSize().heightThe following ... Read More
Smita Kapse
317 Views
You can use subquery. Following is the syntax −SELECT * FROM ( SELECT * FROM yourTableName ORDER BY yourIdColumnName DESC LIMIT 3 ) anyAliasName ORDER BY yourIdColumnName;Let us first create a table −mysql> create table DemoTable ( ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, ClientName varchar(100) ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using insert command ... Read More
Smita Kapse
190 Views
Use $nin operator along with $elemMatch and $not for this. 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.combinationOfArrayDemo.insertOne({"StudentName":"Larry", "StudentAge":21, "StudentFavouriteTechnicalSubject":["C", "Java"]}); { "acknowledged" : true, "insertedId" : ObjectId("5c7f77cc8d10a061296a3c58") } > ... Read More