We can use DISTINCT and COUNT together in a single MySQL query. Firstly, let us create a table. The CREATE command is used to create a table. mysql> create table DistCountDemo - > ( - > id int, - > name varchar(100), - > age int - > ); Query OK, 0 rows affected (0.48 sec) Records are inserted with the help of INSERT command. mysql> insert into DistCountDemo values(1, 'John', 23); Query OK, 1 row affected (0.11 sec) mysql> insert ... Read More
First, let us create a table with the UNIQUE constraint. It suggests that we cannot add duplicate values. Creating a table. mysql> create table UniqueConstraintDemo -> ( -> Name varchar(200) unique -> ); Query OK, 0 rows affected (1.05 sec) Now, we can check whether the table has UNIQUE constraint or not with the help of DESC command. The query is as follows. mysql> DESC UniqueConstraintDemo; The following is the output. +-------+--------------+------+-----+---------+-------+ | Field | Type | Null ... Read More
Cable modem is a hardware device that is used to connect the computer with the Internet Service Provider (ISP) through the local cable TV line. It has two interfaces – one to the cable TV network outlet and the other to a computer or television or set-top box. Configuration Cable modems used to be proprietary in the initial days and had to be installed by the cable company. Nowadays, cable modems of open standards are available that can be personally installed by the user. The standard is called Data Over Cable Service Interface Spectrum (DOSCIS). The modem to computer interface ... Read More
Let’s say we have a table and now there is a requirement to add AUTO_INCREMENT on column name. For that, use the MODIFY command. Here, we will create a demo table first. mysql> create table AddingAutoIncrement -> ( -> Id int, -> Name varchar(200), -> Primary key(Id) -> ); Query OK, 0 rows affected (0.47 sec) We have created a table above and now let us alter the table to add AUTO_INCREMENT on column name ‘Id’. The syntax is as follows − ... Read More
We can convert MySQL date and time to Unix Timestamp with the help of function UNIX_TIMESTAMP(). The following is the query. mysql> SELECT UNIX_TIMESTAMP(STR_TO_DATE('Oct 19 2018 10:00PM', '%M %d %Y %h:%i%p')); After running the above query we will not get the output in date format as shown in the below output. The output shown here is a Unix Timestamp. +------------------------------------------------------------------------+ | UNIX_TIMESTAMP(STR_TO_DATE('Oct 19 2018 10:00PM', '%M %d %Y %h:%i%p')) | +------------------------------------------------------------------------+ | ... Read More
The int type takes 4 byte signed integer i.e. 32 bits ( 232 values can be stored). The BigInt type takes 8 byte signed integer i.e. 64 bits (264 values can be stored). Let us see an example. Creating a table with zerofill, that would add leading zeros. mysql> create table IntandBigint20Demo -> ( -> Number int(20) zerofill, -> Code BigInt(20) zerofill -> ); Query OK, 0 rows affected (0.58 sec) After creating a table, we will insert records into the table. mysql> insert into ... Read More
Key is synonymous to an index. If you want to create an index for a column, then use ‘Key’. As stated in the official docs: KEY is normally a synonym for INDEX. The key attribute PRIMARY KEY can also be specified as just KEY when given in a column definition. This was implemented for compatibility with other database systems. The key can be used with Primary Key: Let us first create a table. Here is the query to set primary key for a column “id”. mysql> create table KeyDemo -> ( ... Read More
Interfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility of the deriving class to define the members. Abstract classes to some extent serve the same purpose, however, they are mostly used when only few methods are to be declared by the base class and the deriving class implements the functionalities. Let us now see the difference between Abstract class and Interface in C#. Inherit A class may inherit more than one interface, whereas a class may inherit only one abstract class. Member Field You ... Read More
Cable modem termination system (CMTS) is a hardware device at the headend of a cable TV network that is used to connect cable subscribers to the Internet Service Provider (ISP). They provide high speed data services like Internet or Voice over Internet Protocol (VoIP) over the cable TV network. Functions CMTS has both radio frequency interfaces and Ethernet interfaces. It transmits and receives user data packets to and from the cable modem attached to the subscriber through HFC network. It then converts them to Internet Protocol packets (IP packets) and routes them to the concerned Internet Service ... Read More
InnoDB is a general-purpose storage engine that balances high reliability and performance. Since MySQL 5.6, InnoDB is the default MySQL storage engine. InnoDB can be used for various purposes. Here are some of them − It can be used for transaction purpose i.e. all ACID properties. InnoDB can be used for row level locking, that means it gives higher performance as compared to MyISAM. InnoDB can be used for both data and index for a large buffer pool. InnoDB can be used when we need better performance than MyISAM. MyISAM is the default storage engine for the MySQL ... Read More