Jennifer Nicholas has Published 332 Articles

How to increase varchar size of an existing column in a database without breaking existing data in MySQL?

Jennifer Nicholas

Jennifer Nicholas

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

427 Views

Increase the varchar size of an existing column in a database with the help of CHANGE command. The syntax is as follows −alter table yourTableName change yourColumnName yourColumnName dataType;Here, we are creating a table with a single column and varchar size 200 −mysql> create table IncreaseVarcharDemo    −> (   ... Read More

Returning a value even if there is no result in a MySQL query?

Jennifer Nicholas

Jennifer Nicholas

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

7K+ Views

You can use IFNULL() function from MySQL to return a value even if there is not result. Let us create a table. Te query to create a table.mysql> create table IfNullDemo    −> (    −> Id int,    −> Name varchar(100)    −> ); Query OK, 0 rows affected ... Read More

Resolve the MySQL error 'TYPE=MyISAM'?

Jennifer Nicholas

Jennifer Nicholas

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

923 Views

To fix the error, you just need to replace TYPE with ENGINE. The syntax to set the engine is as follows −ENGINE = MyISAM;The MySQL error occurs when TYPE is used. Let us see the same scenario while creating a table −mysql> create table Customers −> ( ... Read More

How to return the nth record from MySQL query?

Jennifer Nicholas

Jennifer Nicholas

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

794 Views

To get the nth record from MySQL query, you can use LIMIT. The syntax is as follows −select *from yourTableName order by yourColumnName limit n, 1;To understand the above syntax, let us create a table. The following is the query to create a table −mysql> create table NthRecordDemo ... Read More

How to make MySQL's NOW() and CURDATE() functions use UTC?

Jennifer Nicholas

Jennifer Nicholas

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

133 Views

To make MySQL’s NOW() and CURDATE() functions use UTC, you need to write my.cnf file. Write the below instruction in my.cnf −[mysqld_safe] timezone = UTCFirstly, reach the directory with the help of the following query −mysql> select @@datadir;The following is the output −+---------------------------------------------+ | @@datadir ... Read More

How to insert multiple rows with single MySQL query?

Jennifer Nicholas

Jennifer Nicholas

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

282 Views

You can insert multiple rows with the help of values() separated by comma(, ). The syntax is as follows −insert into yourTableName values(value1, value2, ...N), (value1, value2, ...N), (value1, value2, ...N), (value1, value2, ...N), (value1, value2, ...N), (value1, value2, ...N)................N;To insert multiple rows, let us create a table. The following ... Read More

How to alter multiple columns in a single statement in MySQL?

Jennifer Nicholas

Jennifer Nicholas

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

2K+ Views

Alter multiple columns in a single statement with the help of CHANGE command. The syntax is as follows −alter table yourTableName change yourOldColumnName1 yourNewColumnName1 dataType, yourOldColumnName2 yourNewColumnName2 dataType, . . . NTo understand the above syntax, let us create a table. The query to create a table is as follows ... Read More

8085 program to add 2-BCD numbers

Jennifer Nicholas

Jennifer Nicholas

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

4K+ Views

In this program we will see how to add two 8-bit BCD numbers.Problem StatementWrite 8085 Assembly language program to add two 8-bit BCD number stored in memory location 8000H – 8001H.DiscussionThis task is too simple. Here we are taking the numbers from memory and after adding we need to put ... Read More

How to not allow duplicate entries to be entered a MySQL Table?

Jennifer Nicholas

Jennifer Nicholas

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

385 Views

To not allow any duplicate entry to be entered in a MySQL table, you need to add unique key. The syntax is as follows −alter ignore table yourTableName add constraint unique key(yourColumName);The above syntax sets unique key. To understand the above syntax, let us create a table.The following is the ... Read More

8085 program to check whether the given number is even or odd

Jennifer Nicholas

Jennifer Nicholas

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

8K+ Views

In this program we will see how to check whether a number is odd or even.Problem StatementWrite 8085 Assembly language program to check whether a number is odd or even.DiscussionThe Odd Even checking is very simple. we can determine one number is odd or even by checking only the LSb. ... Read More

Advertisements