Smita Kapse has Published 498 Articles

Can we GROUP BY one column and select all data in MySQL?

Smita Kapse

Smita Kapse

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

1K+ Views

Yes, you can use group_concat() for this. Let us first create a table −mysql> create table groupByOneSelectAll    -> (    -> StudentDetails varchar(100),    -> StudentName varchar(100)    -> ); Query OK, 0 rows affected (0.91 sec)Following is the query to insert some records in the table using insert ... Read More

Insert current date to the database in MySQL?

Smita Kapse

Smita Kapse

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

4K+ Views

To insert current date to the database, you can use NOW(). Following is the syntax −INSERT INTO yourTableName(yourDateColumnName) VALUES(NOW());If your column has datatype date then NOW() function inserts only current date, not time and MySQL will give a warning. To remove the warning, you can use CURDATE().Let us first create ... Read More

Select results from the middle of a sorted list in MySQL?

Smita Kapse

Smita Kapse

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

932 Views

To select results from the middle of a sorted list, use ORDER BY clause along with LIMIT.Let us first create a table. Following is the query −mysql> create table sortedListDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(100)    -> ); Query ... Read More

C/C++ Struct vs Class

Smita Kapse

Smita Kapse

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

419 Views

In C++ the structure and class are basically same. But there are some minor differences. These differences are like below.The class members are private by default, but members of structures are public. Let us see these two codes to see the differences.Example#include using namespace std; class my_class {   ... Read More

C++ Program to Implement Disjoint Set Data Structure

Smita Kapse

Smita Kapse

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

3K+ Views

Disjoint set is basically as group of sets where no item can be in more than one set. It supports union and find operation on subsets.Find(): It is used to find in which subset a particular element is in and returns the representative of that particular set.Union(): It merges two ... Read More

C++ Program to Implement Gauss Seidel Method

Smita Kapse

Smita Kapse

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

4K+ Views

Gauss Seidel method is used to solve linear system of equations in iterative method. This is a C++ Program to Implement Gauss Seidel Method.AlgorithmBegin    Take the dimensions of the matrix p and its elements as input.    Take the initials values of x and no of iteration q as ... Read More

C++ Program to Perform Optimal Paranthesization Using Dynamic Programming

Smita Kapse

Smita Kapse

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

202 Views

This is a C++ program to perform Optimal Paranthesization using Dynamic Programming.AlgorithmBegin    Take the length n and dimension of matrix as input.    MatrixChain() to find out minimum multiplications:    Arguments:       a[i][j]=Minimum number of scalar multiplications needed to          compute the matrix A[i]A[i+1]...A[j] ... Read More

How to use replaceAll () in Android textview?

Smita Kapse

Smita Kapse

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

544 Views

This example demonstrate about How to use replaceAll () in Android textview.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 find through list of ids in MongoDB?

Smita Kapse

Smita Kapse

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

2K+ Views

You can use $in operator to find through the list of ids in MongoDB. 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.findListOfIdsDemo.insertOne({"StudentName":"Carol", "StudentAge":21}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8ecadd2f684a30fbdfd575") ... Read More

How to replace substring in MongoDB document?

Smita Kapse

Smita Kapse

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

997 Views

In order to replace substring in MongoDB document, you can use the replace() function. To understand it further, let us create a collection with document. The query to create a collection with document is as follows −> db.replaceSubstringDemo.insertOne({"WebsiteURL":"www.gogle.com"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c76eaf21e9c5dd6f1f78276") }Display all documents ... Read More

Advertisements