Add Not Null Constraint to Existing Column in MySQL

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

2K+ Views

To add not null constraint to an existing column in MySQL, we will use the ALTER command. This is a type of validation to restrict the user from entering null values. Let us see an example. Firstly, we will create a table. The CREATE command is used to create a table. mysql> create table AddNotNUlldemo - > ( - > name varchar(100) - > ); Query OK, 0 rows affected (0.44 sec) To insert records. mysql> insert into AddNotNUlldemo values('John'); Query OK, 1 row affected (0.19 sec) ... Read More

Use MySQL REPLACE to Replace Strings in Multiple Records

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

1K+ Views

The replace() function can be used to replace a string with another string. To understand replace(), we need to create a table with some records. The following is the query to create a table. mysql> create table replaceDemo -> ( -> Name varchar(200) -> ); Query OK, 0 rows affected (0.55 sec) Insert some records with the help of INSERT command. The query to insert records is as follows − mysql> insert into replaceDemo values('John'); Query OK, 1 row affected (0.17 sec) mysql> insert into replaceDemo values('Demo'); ... Read More

Cable Internet

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

3K+ Views

Cable Internet is a category of broadband Internet access that uses the infrastructure of cable TV network to provide Internet services. Cable Internet provides connectivity from the Internet service provider (ISP) to the end users in a similar manner as digital subscriber line (DSL) and fiber-to-the-home (FTTH). System Layout Broadband cable Internet access has a cable modem termination system (CMTS) at a cable operator facility, called a headend. Headend is connected to switching centers by high bandwidth fiber trunk. Each switching center is connected to one or more fiber nodes through fiber optic cables. The local coaxial cable ... Read More

Add Composite Primary Key in MySQL Using ALTER TABLE

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

1K+ Views

To add composite primary key, use the ALTER command. Let us first create a demo table The query to create a table. mysql> create table CompositePrimaryKey -> ( -> Id int, -> StudentName varchar(100), -> Age int -> ); Query OK, 0 rows affected (0.56 sec) Haven’t added composite primary key above till now. Let us now check with the help of desc command. mysql> desc CompositePrimaryKey; The following is the output. +-------------+--------------+------+-----+---------+-------+ | Field ... Read More

C# Equivalent to Java's Thread.setDaemon

varun
Updated on 30-Jul-2019 22:30:23

384 Views

C# equivalent to Java's Thread.setDaemon is the concept of foreground and background threads. When the foreground threads will close, the background threads will be terminated. Foreground threads continue to run until the last foreground thread is terminated. The property used for background thread is IsBackground that gets or sets a value indicating whether a thread is a background thread. The default value of this property would be false because the default threads created are Foreground Threads. To make a thread Daemon in C#, use the isBackground − Thread bgThread = new Thread(tStart); bgThread.IsBackground = true; bgThread.Start();

Check for K Consecutive 1's in a Binary Number

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

379 Views

First we take a user input string with the combination of 1’s and 0’s.then create a new string with 1’s, then check if there is any p number of consecutive 1’s is present or not. If present then display FOUND otherwise NOTFOUND. Example Binary number ::1111001111 Enter consecutive 1’s :3 Consecutive 1's is Found Algorithm Step 1: input a string with the combination of 1’s, it’s stored in the variable X and 0’s and p is the consecutive 1’s in a binary number. Step 2: form a new string of p 1’s. newstring=”1”*p Step ... Read More

Using DISTINCT and COUNT Together in a MySQL Query

Chandu yadav
Updated on 30-Jul-2019 22:30:23

465 Views

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

Dropping Unique Constraint from MySQL Table

George John
Updated on 30-Jul-2019 22:30:23

489 Views

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 Modems

Chandu yadav
Updated on 30-Jul-2019 22:30:23

5K+ Views

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

Alter MySQL Column to be Auto Increment

Chandu yadav
Updated on 30-Jul-2019 22:30:23

3K+ Views

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

Advertisements