Hello Everyone, I am learning SQL and I want to know how do I practise daily for DDL commands? Can anyone tell me some tips to get an expert to generate a DDL query?
no need to practice !!
if you can understand and do !! its going to be really fast
take notes ... look at notes ... and do !!! easiest way !!
you can do complicated complicated things also !!!
Yes, it is correct, These commands you can learn easily without doing practices.
Here I am sharing the examples of DDL Commands:
- DROP Command
DROP TABLE <table_name>
- Create Table Command
CREATE TABLE Student
- TRUNCATE Command
TRUNCATE TABLE <Table_name>
- RENAME Command
- ALTER Table Command
ALTER TABLE <table_name>
ADD ( <Data_Type>(),......n)
- Dropping a Column from the Table
ALTER TABLE <table_name> DROP COLUMN <column_name>
- Modifying Existing Table
ALTER TABLE <table_name> MODIFY (<column_name> ())
I have to disagree with the others on this subject. Practice is actually a very good thing even for something that everyone else seems to claim as being "simple".
A perfect example of this would be how to build a TRUNCATE TABLE into a stored procedure that must be executed by someone only with PUBLIC privs and Execute privs on the stored procedure to be executed. Another good example would be how to add more than one column at a time to a table, how to detect if the columns had already been added, and how to check for and correct the massive fragmentation that can occur when you do such a thing. There's also thinks like how to recover the space from when you drop a variable width column like a VARCHAR, which is not automatically done during a drop. Same goes for LOBs but much worse. Then there's the horror of what happens when you rename a table without knowing all the ramifications.
The bottom line is that, while it's certainly easy to memorize the syntax for DDL, learning the full impact and what to do during and after a lot of the DDL changes is even more important than the DDL itself. Anyone that thinks "practice for DDL" is unimportant obviously needs more practice themselves. That's not meant as a snarky remark... that's meant as a fact and a very strong recommendation.
To do otherwise would set you up for "Death by SQL"... seriously. Take it from the old-dude that learned a lot of those things the hard way.