Get Only Floating Point Numbers from a List of Values in MySQL

AmitDiwan
Updated on 23-Aug-2019 07:38:43

514 Views

Let us first create a table −mysql> create table DemoTable628 (Value DECIMAL(10, 2)); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable628 values(10.97); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable628 values(20.04); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable628 values(12.00); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable628 values(89.56); Query OK, 1 row affected (0.20 sec)Display all records from the table using select statement −mysql> select *from DemoTable628;This will produce the following output −+-------+ | Value | +-------+ | 10.97 ... Read More

Finding the Number of Spanning Trees in a Graph

Mahesh Parahar
Updated on 23-Aug-2019 07:32:20

496 Views

Problem StatementFind the number of spanning trees in the following graph.SolutionThe number of spanning trees obtained from the above graph is 3. They are as follows −These three are the spanning trees for the given graphs. Here the graphs I and II are isomorphic to each other. Clearly, the number of non-isomorphic spanning trees is two.

Convert Every Value in a MySQL Column to Uppercase

AmitDiwan
Updated on 23-Aug-2019 07:32:02

372 Views

For this, use UPPER() on MySQL column. Let us first create a table −mysql> create table DemoTable627 (Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, FirstName varchar(100)); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable627(FirstName) values(UPPER('John')); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable627(FirstName) values(UPPER('Sam')); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable627(FirstName) values(UPPER('Mike')); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable627(FirstName) values(UPPER('Carol')); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable627(FirstName) values(UPPER('dAVID')); Query OK, 1 row affected (0.70 ... Read More

Finding the Number of Regions in the Graph

Mahesh Parahar
Updated on 23-Aug-2019 07:31:20

6K+ Views

Problem StatementLet 'G' be a connected planar graph with 20 vertices and the degree of each vertex is 3. Find the number of regions in the graph.SolutionBy the sum of degrees theorem, 20 ∑ i=1  deg(Vi) = 2|E|20(3) = 2|E||E| = 30By Euler’s formula,|V| + |R| = |E| + 220+ |R| = 30 + 2|R| = 12Hence, the number of regions is 12.

Pad Values of a Column with Zeros in MySQL

AmitDiwan
Updated on 23-Aug-2019 07:29:31

154 Views

For this, use the concept of ZEROFILL. It pads the displayed value of the field with zeros up to the display width set in the column definitionLet us first create a table −mysql> create table DemoTable626 (Value int(5) zerofill); Query OK, 0 rows affected (0.71 sec)Insert some records in the table using insert command −mysql> insert into DemoTable626 values(9); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable626 values(12); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable626 values(567); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable626 values(3478); Query OK, 1 row affected ... Read More

Finding Simple Non-Isomorphic Graphs with n Vertices

Mahesh Parahar
Updated on 23-Aug-2019 07:28:28

5K+ Views

Problem StatementHow many simple non-isomorphic graphs are possible with 3 vertices?SolutionThere are 4 non-isomorphic graphs possible with 3 vertices. They are shown below.

Finding the Matching Number of a Graph

Mahesh Parahar
Updated on 23-Aug-2019 07:27:07

887 Views

Problem StatementWhat is the matching number for the following graph?SolutionNumber of vertices = 9We can match only 8 vertices.Matching number is 4.

Finding the Line Covering Number of a Graph

Mahesh Parahar
Updated on 23-Aug-2019 07:25:32

548 Views

Problem StatementWhat is the line covering number for the following graph?SolutionNumber of vertices = |V| = n = 7Line covering number = (α1) ≥ ⌈ n / 2 ⌉ = 3α1 ≥ 3By using 3 edges, we can cover all the vertices.Hence, the line covering number is 3.

Select and Display Rows from a Column in MySQL Table

AmitDiwan
Updated on 23-Aug-2019 07:25:10

307 Views

Let us first create a table −mysql> create table DemoTable625 (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentFirstName varchar(100), StudentScore int ); Query OK, 0 rows affected (1.01 sec)Insert some records in the table using insert command −mysql> insert into DemoTable625(StudentFirstName, StudentScore) values('John', 98); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable625(StudentFirstName, StudentScore) values('Chris', 39); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable625(StudentFirstName, StudentScore) values('Bob', 41); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable625(StudentFirstName, StudentScore) values('David', 40); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable625(StudentFirstName, StudentScore) ... Read More

Finding the Chromatic Number of Complete Graph

Mahesh Parahar
Updated on 23-Aug-2019 07:23:37

4K+ Views

Problem StatementWhat is the chromatic number of complete graph Kn?SolutionIn a complete graph, each vertex is adjacent to is remaining (n–1) vertices. Hence, each vertex requires a new color. Hence the chromatic number Kn = n.

Advertisements