Power Set

Mahesh Parahar
Updated on 26-Aug-2019 06:07:19

750 Views

Power set of a set S is the set of all subsets of S including the empty set. The cardinality of a power set of a set S of cardinality n is 2n. Power set is denoted as P(S).Example −For a set S = { a, b, c, d } let us calculate the subsets −Subsets with 0 elements − { ∅ } (the empty set)Subsets with 1 element − { a }, { b }, { c }, { d }Subsets with 2 elements − { a, b }, { a, c }, { a, d }, { b, ... Read More

Sort Domain Names in MySQL

AmitDiwan
Updated on 26-Aug-2019 06:05:27

133 Views

To sort domain names, use the ORDER BY SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable670(DomainName text); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command. Here, we are inserting domain names −mysql> insert into DemoTable670 values('www.facebook.com'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable670 values('www.google.com'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable670 values('www.amazon.com'); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable670;This will produce the following output −+------------------+ | DomainName       ... Read More

Planar Graphs

Mahesh Parahar
Updated on 26-Aug-2019 06:04:22

5K+ Views

Planar graph − A graph G is called a planar graph if it can be drawn in a plane without any edges crossed. If we draw graph in the plane without edge crossing, it is called embedding the graph in the plane.Non-planar graph − A graph is non-planar if it cannot be drawn in a plane without graph edges crossing.

JavaScript Boolean Function

vineeth.mariserla
Updated on 23-Aug-2019 15:17:10

189 Views

Boolean functionWhile developing, a developer may come across yes/no situation. At that point of time Boolean() function can be used. It results only in true or false. Let's discuss it in detail.syntaxBoolean(exp);It takes an expression and scrutinizes it and displays either true or false based on the validity of the expression.Example-1In the following example, various values have been checked whether they are true or not using Boolean() function. If any value has any legitimate value then it results in true else it results in false.  var a = 0;           ... Read More

Convert MySQL Date Format from yyyy-mm-ddThh:mm:ss.sssZ to yyyy-mm-dd hh:mm:ss

AmitDiwan
Updated on 23-Aug-2019 14:00:12

3K+ Views

Let us first create a table −mysql> create table DemoTable668(JoiningDate varchar(200)); Query OK, 0 rows affected (0.97 sec)Insert some records in the table using insert command. We have inserted date in the format yyyy-mm-ddThh:mm:ss.sssZ −mysql> insert into DemoTable668 values('2001-01-10T06:20:00.000Z'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable668 values('2019-07-20T04:00:00.000Z'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable668 values('2016-02-12T05:10:50.000Z'); Query OK, 1 row affected (0.17 sec)Display all records from the table using select statement −mysql> select *from DemoTable668;This will produce the following output −+--------------------------+ | JoiningDate             | +--------------------------+ | ... Read More

Planar Graphs and Their Properties

Mahesh Parahar
Updated on 23-Aug-2019 13:59:12

6K+ Views

A graph 'G' is said to be planar if it can be drawn on a plane or a sphere so that no two edges cross each other at a non-vertex point.ExampleRegionsEvery planar graph divides the plane into connected areas called regions.ExampleDegree of a bounded region r = deg(r) = Number of edges enclosing the regions r.deg(1) = 3 deg(2) = 4 deg(3) = 4 deg(4) = 3 deg(5) = 8Degree of an unbounded region r = deg(r) = Number of edges enclosing the regions r.deg(R1) = 4 deg(R2) = 6In planar graphs, the following properties hold good −1. In a ... Read More

Pendent Vertex, Isolated Vertex and Adjacency of a Graph

Mahesh Parahar
Updated on 23-Aug-2019 13:22:55

10K+ Views

Pendent VertexBy using degree of a vertex, we have a two special types of vertices. A vertex with degree one is called a pendent vertex.ExampleHere, in this example, vertex 'a' and vertex 'b' have a connected edge 'ab'. So with respect to the vertex 'a', there is only one edge towards vertex 'b' and similarly with respect to the vertex 'b', there is only one edge towards vertex 'a'. Finally, vertex 'a' and vertex 'b' has degree as one which are also called as the pendent vertex.Isolated VertexA vertex with degree zero is called an isolated vertex.ExampleHere, the vertex 'a' ... Read More

MySQL Query to Select Closest Date from Today

AmitDiwan
Updated on 23-Aug-2019 13:19:44

2K+ Views

Let’s say the current date is 2019-07-25. We will now see an example and create a table where ShippingDate is added in the table.Let us first create a table −mysql> create table DemoTable667(ShippingDate datetime); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert command −mysql> insert into DemoTable667 values('2019-01-31'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable667 values('2019-07-19'); Query OK, 1 row affected (0.69 sec) mysql> insert into DemoTable667 values('2019-07-23'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable667 values('2019-08-24'); Query OK, 1 row affected (0.15 sec)Display all records from ... Read More

Partitioning of a Set

Mahesh Parahar
Updated on 23-Aug-2019 13:18:18

10K+ Views

Partition of a set, say S, is a collection of n disjoint subsets, say P1, P1, ... Pn that satisfies the following three conditions −Pi does not contain the empty set.                        [ Pi ≠ { ∅ } for all 0 < i ≤ n ]The union of the subsets must equal the entire original set.                       [ P1 ∪ P2 ∪ ... ∪ Pn = S ]The intersection of any two distinct sets is empty.            ... Read More

Grant Replication Privilege to a Database in MySQL

AmitDiwan
Updated on 23-Aug-2019 13:15:43

1K+ Views

To grant replication privilege, use GRANT REPLICATION SLAVE ON.First list all the user names along with host from MySQL.user table −mysql> select user, host from mysql.user;This will produce the following output −+------------------+-----------+ | user             | host | +------------------+-----------+ | Bob              | % | | Charlie          | % | | Robert           | % ... Read More

Advertisements