In noncat table, change the category for item UF39 to null

Question

In the noncat table, change the category for item UF39 to null

Field Type Null Key Default
ITEM_ID char(4) No PRI Null
DESCRIPTION char(30) Yes Null
ON_HAND int Yes Null
CATEGORY char(3) Yes Null
PRICE decimal(5.2) Yes Null

Explanation

Here we have a noncat table. And we have to change the category.

SQL is a structured query language. This language is use to store the data. So that lost data can be find easily.

There are different commands and keys are available in SQL to run the code.

Keys like Primary key, foreign key and unique key.

Commands like, INSERT, DELETE, UPDATE, DROP, CREATE, ALTER.

In SQL data is always store in the form of tables.

Code for SQL commands are:

Create table NONCAT(ITEM_ID char(4) primary key NOT NULL, DESCRIPTION char(30) DEFAULT NULL, ON_HAND int DEFAULT NULL, CATEGORY char(3) DEFAULT NULL, PRICE decimat(5.2) DEFAULT NULL);

INSERT INTO NONCAT VALUES("UF39","abcd",10,"ABC",123.45);

ALTER table NONCAT ALTER column ITEM_ID char(4) NULL;

UPDATE NONCAT
SET ITEM_ID=NULL
where ITEM_ID="UF39";

SELECT * from NONCAT;

Output

noncat table

 

 

Also read, Answer the following question for the logical gate operates

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *