{"id":200,"date":"2014-06-26T08:03:44","date_gmt":"2014-06-26T08:03:44","guid":{"rendered":"http:\/\/dstarena.com\/blog\/?p=200"},"modified":"2017-01-06T07:33:38","modified_gmt":"2017-01-06T07:33:38","slug":"sql-structured-query-language-basics","status":"publish","type":"post","link":"http:\/\/dstarena.com\/blog\/sql-structured-query-language-basics\/","title":{"rendered":"SQL: Structured Query Language basics"},"content":{"rendered":"<p style=\"text-align: justify;\">Structured query language is abbreviated as SQL. SQL\u00a0has three classification of command languages, they are :<\/p>\n<ol style=\"text-align: justify;\">\n<li>DDL: Data Definition Language<\/li>\n<li>DM: Data Manipulation Language<\/li>\n<li>TCL: Transaction Control Language<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">These three command languages help one to access SQL, using this one can create, update, manipulate, save and delete database tables.<\/p>\n<p style=\"text-align: justify;\">DDL<\/p>\n<p style=\"text-align: justify;\">DDL or Data Definition Language is used to describe the basics of a table, it defines the database tables. In this we have following commands:<\/p>\n<ol style=\"text-align: justify;\">\n<li>Create<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">This command is used to create a new table in a database.<\/p>\n<p style=\"text-align: justify;\">Code:\u00a0 &gt;&gt;create table tablename ();<\/p>\n<p style=\"text-align: justify;\">&gt;&gt; create table employee ();<\/p>\n<p style=\"text-align: justify;\">The above command creates a table with name employee but this table will have no attributes in it. To add attributes we have to write in this form;<\/p>\n<p style=\"text-align: justify;\">&gt;&gt;create table employee (empname varchar2 (30),<\/p>\n<p style=\"text-align: justify;\">empno number (4),<\/p>\n<p style=\"text-align: justify;\">\u00a0empbranch varchar2 (10));<\/p>\n<p style=\"text-align: justify;\">The above table is now created with \u00a0three attributes employee name as empname; employee number as empno; \u00a0employee branch as empbranch.<\/p>\n<ol style=\"text-align: justify;\">\n<li>Alter<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">Alter can be used in two ways:<\/p>\n<ul style=\"text-align: justify;\">\n<li>To add a new column:<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">&gt;&gt;alter table employee add (empcity\u00a0 varchar2(20));<\/p>\n<p style=\"text-align: justify;\">This adds a new column to table employee named employee city as empcity.<\/p>\n<ul style=\"text-align: justify;\">\n<li>For modification of existing table (empno\u00a0 number(5));<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">&gt;&gt;alter table employee modify (empno\u00a0 number(5));<\/p>\n<p style=\"text-align: justify;\">This modifies table employee, it column empno with datatype number (4) to number (5).<\/p>\n<ol style=\"text-align: justify;\">\n<li>Drop<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">This helps in dropping the table or delete the whole table from the database.<\/p>\n<p style=\"text-align: justify;\">&gt;&gt;drop employee;<\/p>\n<ol style=\"text-align: justify;\">\n<li>Desc<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">This command describes the table and its columns having its type and other attributes.<\/p>\n<p style=\"text-align: justify;\">&gt;&gt;desc employee;<\/p>\n<ol style=\"text-align: justify;\">\n<li>Truncate<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">This command is used to delete all the data from the table;<\/p>\n<p style=\"text-align: justify;\">&gt;&gt; truncate table employee; \/\/this delete all the data from the table.<\/p>\n<p style=\"text-align: justify;\">Stay connected to our next post we will be dealing with \u00a0DML And TCL.<\/p>\n<p style=\"text-align: justify;\">Hit like if you found this post useful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Structured query language is abbreviated as SQL. SQL\u00a0has three classification of command languages, they are : DDL: Data Definition Language DM: Data Manipulation Language TCL: Transaction Control Language These three command languages help one to access SQL, using this one can create, update, manipulate, save and delete database tables. DDL DDL or Data Definition Language [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[291,293,290,292,52,289],"class_list":["post-200","post","type-post","status-publish","format-standard","hentry","category-general","tag-basics-of-sql","tag-best-website-design-training-institute-in-bhopal","tag-java-training-in-bhopal","tag-learn-online-sql","tag-matlab-training-in-bhopal","tag-phpmysql-website-training-in-bhopal"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/posts\/200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/comments?post=200"}],"version-history":[{"count":4,"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/posts\/200\/revisions"}],"predecessor-version":[{"id":3702,"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/posts\/200\/revisions\/3702"}],"wp:attachment":[{"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/media?parent=200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/categories?post=200"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dstarena.com\/blog\/wp-json\/wp\/v2\/tags?post=200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->