DDL Statements In Oracle RDBMS Pt.2

DDL Statements In Oracle RDBMS Pt.2

Today we will be learning about DDL Statements using Oracle 10g. I will target our future articles in preparation for the Data Systems + examination that CompTia will release next year. I will take the Beta examination on December 7th, so be prepared to read my review. I hope we enjoy this article and look forward to our next lesson together! The lessons are essential to understand. I will try to switch to different database platforms, such as SQL and NoSQL, so we get whole experience and preparation to become highly qualified Database Administrators.


Objectives Covered Todays Lesson

  • DROP STATEMENT
  • UNUSED STATEMENT
  • DROP STATEMENT
  • TRUNCATE STATEMENT



DROP STATEMENT

The drop statement can be used to drop existing columns inside the database. For example,, please take a look at the explanation below. We are dropping the USERID column from the example's existing "lessonOne" database table.

alter table lessonOne drop column USERID;         
No alt text provided for this image

UNUSED STATEMENT

Oracle databases also allow us to claim columns as unused inside the database. This is similar to using the drop statement to eliminate the column. But this statement does not drop the column. Moreover, it hides it from the database table, making it unseen to the administrator. Refer to the example below.

alter table lessonOne set unused column GENDER;         
No alt text provided for this image

DROP STATEMENT

This statement can be used to permanently get rid of the table inside the database. The statement is simple but very powerful. Once you drop the database table, you will never be able to recover the table as it was purged from the database. We will wait to drop the lessonOne table for this week's lesson, but I went ahead and listed the syntax to perform the database table drop!

drop table lessonOne;         

TRUNCATE STATEMENT

Let us say you want to delete all the data inside columns. Well, how can we do that? This is not complicated at all. Rather than deleting all the columns individually, we can use the truncate statement. This command will simply delete all columns inside the database while keeping the architecture of the database intact.

truncate table lessonOne;         
No alt text provided for this image
the example demonstrates truncating of lesson one table

Conclusion

Today we covered some basic Oracle SQL statements using SQL Plus and Oracle 10g. We will soon be going into more depth with the database administrator & engineering. The goal for future articles will be to prepare for CompTIA Data Systems + examination. At the same time, we will be using Oracle database technology. I have attached the exam objectives for the Data Systems + examination to this article for anyone interested in topics we will cover in this newsletter!

Link: CompTIA Data Systems Beta Exam | Become A Subject Matter Expert | CompTIA IT Certifications

Ahmad Hussein

Operations Manager .Hospitals Management

1 年

Well done

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了