Ankith Reddy has Published 1132 Articles

How to set NOW() as default value for datetime datatype in MySQL?

Ankith Reddy

Ankith Reddy

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

6K+ Views

We can set the now() function as a default value with the help of dynamic default. First, we will create a table with data type” datetime”. After that, we will set now() as the default value for column “MyTime” as shown below. Creating a table. mysql> create table DefaultDateTimeDemo ... Read More

What is the C# equivalent for the Java System.exit(0)?

Ankith Reddy

Ankith Reddy

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

2K+ Views

The C# equivalent for Java System.exit(0) is − Environment.Exit(exitCode); The Environment.Exit() method terminates this process and returns an exit code to the operating system. Above, use exitCode as 0 (zero) to show that the process completed successfully. Use exitCode as a non-zero number to show an error, for ... Read More

How to add not null constraint to existing column in MySQL?

Ankith Reddy

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 ... Read More

Cable Internet

Ankith Reddy

Ankith Reddy

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

2K+ 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 ... Read More

ALTER TABLE to add a composite primary key in MySQL?

Ankith Reddy

Ankith Reddy

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

917 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 ... Read More

How to convert MySQL datetime to Unix timestamp?

Ankith Reddy

Ankith Reddy

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

14K+ Views

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 ... Read More

Difference between String and StringBuilder in C#

Ankith Reddy

Ankith Reddy

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

2K+ Views

Strings in C# String is immutable in C# that would mean you couldn’t modify it after it is created. It creates a new object of string type in memory if you will perform any operation. string str1 = "Welcome!"; // creates a new string instance str1 += "Hello"; str1 ... Read More

Is it possible to have a function-based index in MySQL?

Ankith Reddy

Ankith Reddy

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

179 Views

Function-based index wasn’t possible in MySQL versions below 5.6. Firstly, to create function-based index in MySQL, we will create a table. mysql> create table FunctionIndexDemo - > ( - > FirstName varchar(100) - > ); Query OK, 0 rows affected ... Read More

MySQL's DESCRIBE command?

Ankith Reddy

Ankith Reddy

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

7K+ Views

The MySQL’s DESCRIBE or DESC both are equivalent. The DESC is the short form of DESCRIBE command and used to dipslay the information about a table like column names and constraints on column name. The DESCRIBE command is equivalent to the following command − SHOW columns from yourTableName command. ... Read More

How to create a MySQL table with MyISAM engine table?

Ankith Reddy

Ankith Reddy

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

2K+ Views

To create a MySQL table with MyISAM engine, we can use ENGINE command. Let us first create a table using CREATE command. mysql> create table StudentRecordWithMyISAM -> ( -> Id int, -> StudentName varchar(100), -> StudentAge int ... Read More

Advertisements