BHAILOG PROGRAMMER
  • Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Disclaimer
  • Home
  • C++ PROGRAM
  • Java Program
  • VB.NET PROGRAM
  • ANDROID
  • SQL
  • Q/A
  • Books
Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Tuesday, February 5, 2019

Data Manipulation Language Command (DML)

 BHAILOG     February 05, 2019     SQL     No comments   


Structured Query Language(SQL) as we all know is the database language by the use of which we can perform certain operations on the existing database and also we can use this language to create a database. SQL uses certain commands like Create, Drop, Insert etc. to carry out the required tasks.

These SQL commands are mainly categorized into four categories as discussed below:

DML (Data Manipulation Language):

Data Manipulation Language (DML) statements or commands are used for managing data within tables.

Some commands of DML are:
INSERT – insert data into a table.
UPDATE – updates existing data within a table.
DELETE – deletes all records from a table, the space for the records remain.
SELECT – retrieve data from the a database.


[1]INSERT:

The insert statement is used to add new row to a table.In insert commands, they have 5 syntax are as follows:

SYNTAX 1:  insert  into table_name
                     values(value1,value2,.....,valuen);

SYNTAX 2:  insert  into table_name(column_Name1,column_Name2,column_Name3)  
                     values(value1,value2,value3);

SYNTAX 3:  insert  into table_name(column_Name1,column_Name2,....)  
                     values(value1,value2,....);

SYNTAX 4:  insert  into table_name
                     values(&column_Name1,&column_Name2,........,&column_Namen);
   
SYNTAX 5:  insert  into table_name
                     select  * from  exiting  table_name;

EXAMPLE:  insert  into emp
                     values(1,'ram');

NOTE: The inserted values must match the table structure exactly in the number of attributes and the data type of each attribute. Character type values are always enclosed in single quotes; number values are never in quotes; date values are often (but not always) in the format ‘yyyy-mm-dd’ (for example, ‘2006-11- 30’).The syntax 4 is not run on  'Oracle Database 10g Express Edition'. This syntax run on  'Run SQL Command Line'are the option of  'Oracle Database 10g Express Edition'.


[2]UPDATE :

The update statement is used to change values that are already in a table.

SYNTAX:  update table_name
                  set  column_Name = new_value
                  where condition;

EXAMPLE:  update emp
                     set  empname = 'rakesh'
                     where empno=11;


NOTE: The update expression can be a constant, any computed value, or even the result of a SELECT statement that returns a single row and a single column.



[3]DELETE :

The delete statement deletes row(s) from a table.

SYNTAX:  delete  from  table_name
                  where condition;

EXAMPLE:  delete  from emp
                     where empno=11;

NOTE: If the WHERE clause is omitted, then every row of the table is deleted that matches with the specified condition.


[4] SELECT :

The SELECT statement is used to form queries for extracting information out of the database.

SYNTAX 1:  select  * from  table_name
                    where condition;

SYNTAX 2:  select  column_Name1,column_Name2  from  table_name
                    where condition;

EXAMPLE:  select  * from emp                   or     select  empname from emp
                      where empname='rajesh';                   where salary< 60000;


Apart from these statements, some statements are also used to control the transaction made by DML statements. The commands used for this purpose are called Transaction Control (TCL) statements. It allows statements to be grouped together into logical transactions.

We are learn TCL and DCL COMMAND in the next tutorial.



If you liked the tutorial then don’t forget to comment and share!


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Data Definition Language command (DDL)

 BHAILOG     February 05, 2019     SQL     No comments   

Structured Query Language(SQL) as we all know is the database language by the use of which we can perform certain operations on the existing database and also we can use this language to create a database. SQL uses certain commands like Create, Drop, Insert etc. to carry out the required tasks.

These SQL commands are mainly categorized into four categories as discussed below:

DDL(Data Definition Language) : DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in database.
Examples of DDL commands:

[1] CREATE – is used to create the database or its objects (like table, index, function,              views, store procedure and  triggers).

SYNTAX :     create  table  table_name                                                                                                                             (column_Name1   data_type(size),                                      
                         column_Name2   data_type(size),        
                          .                                                                         
                          .                                                          
                         column_Namen   data_type(size));   

EXAMPLE :    create  table  empolyee
                          (empno  number(5) ,
                           ename  char(20) ,
                           job  varchar2(20),
                           salary  number(10,2),
                           commission  number(10,2),
                           deptno  number(10));                                   



[2] ALTER- is used to alter the structure of the database i.e. modify the structure or schema of the database ( table).

In ALTER command, they have 4 option are as following:


                                                    (1) ADD - add the new column in a table.
     
 SYNTAX :  alter  table  table_name                             
                       add(column_Name1   data_type(size),                                        
                               .
                               .
                               column_Namen   data_type(size));

EXAMPLE :  alter  table  employee
                       add(mobileno number(10));


                                    (2) MODIFY - change the data_type(size) of column in a table.                         

SYNTAX :    alter  table  table_name                             
                       modify(column_Name   data_type(size)); 

EXAMPLE : alter  table  employee
                       modify(name varchar2(20));
                                    

                                                     (3) DROP - drop the column in a table.
     
SYNTAX :   alter  table  table_name                          
                      drop   column  column_name;   

 EXAMPLE :  alter  table  employee
                        drop(mobileno number(10));
                                                                                                           
                                             (4) RENAME- change the name column in a table.

 SYNTAX : alter  table  table_name                              
                     rename  column  old  column_name to  new  column_name; 

 EXAMPLE :  alter  table  employee
                         rename column ename to  empname;



[3] DROP – is used to delete objects from the database and  table structure i.e.we can not have table,this time use drop command.

SYNTAX :   drop  table  table_name  

EXAMPLE :  drop  table  employee



[4] DESC - This commands is used for  display the structure of table.

SYNTAX :   desc  table_name;

EXAMPLE :    desc  employee;



[5]TRUNCATE–is used to remove all records from a table, including all spaces allocated for the records  are removed. It keep the data structure of table and rollback option is not work after truncate  command  use.

SYNTAX :  truncate  table  table_name     

EXAMPLE :    truncate  table  employee


[6]RENAME-is used  to change the name of  table.

SYNTAX :  rename  old  table_name  to new  table_name;

EXAMPLE :  rename  employee to  emp;


[7]CREATE  USER– is used to create user in the database or identified by password.

SYNTAX : create user user-name  identified by password         
                                                                                                                          
EXAMPLE :  create user raj  identified by  raj@123


If you liked the tutorial then don’t forget to comment and share!

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Information And Use Of SQL(Structured Query Language)

 BHAILOG     February 05, 2019     SQL     No comments   

WHAT IS RELATIONAL DATABASE MANAGEMENT SYSTEM ?



image resourse

A relational database management system (RDBMS) is a collection of programs and capabilities that enable IT teams and others to create, update, administer and otherwise interact with a relational database. Most commercial RDBMS Structured Query Language (SQL) to access the database, although SQL was invented after the initial development of the relational model and is not necessary for its use.

In general, databases store sets of data that can be queried for use in other applications. A database management system supports the development, administration and use of database platforms.

An RDBMS is a type of DBMS with a row-based table structure that connects related data elements and includes functions that maintain the security, accuracy, integrity and consistency of the data.

The most common means of data access for the RDBMS is via SQL. Its main language components comprise data manipulation language (DML) and data definition language (DDL) statements. Extensions are available for development efforts that pair SQL use with common programming languages, such as COBOL (Common Business-Oriented Language), Java and .NET.

WHAT IS SQL ?


Imge Resourse 

SQL (Structured Query Language) is a standardized programming language that's used to manage relational databases and perform various operations on the data in them. Initially created in the 1970s, SQL is regularly used not only by database administrators, but also by developers writing data integration scripts and data analysts looking to set up and run analytical queries.


The uses of SQL include modifying database table and index structures; adding, updating and deleting rows of data; and retrieving subsets of information from within a database for transaction processing and analytics applications. Queries and other SQL operations take the form of commands written as statements -- commonly used SQL statements include select, add, insert, update, delete, create, alter and truncate.

WHAT IS ORACLE ?


       image resourses

Oracle is one of the largest vendors in the enterprise IT market and the shorthand name of its flagship product, a relational database management system (RDBMS) that's formally called Oracle Database. The database software sits at the center of many corporate IT environments, supporting a mix of transaction processing, business intelligence and analytics applications.

Like other RDBMS software, Oracle Database is built on top of SQL, a standardized programming language that database administrators, data analysts and other IT professionals use to manage databases and query the data stored in them. The Oracle software is tied to PL/SQL, an implementation developed by Oracle that adds a set of proprietary programming extensions to standard SQL -- a common practice among RDBMS vendors. 





Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Older Posts Home

Popular

  • WINTER – 2018 EXAMINATION
    WINTER – 2018 EXAMINATION
    WINTER – 2018 EXAMINATION  MODEL ANSWER MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION DOWNLOAD PDF Information Technology Department...
  • VB.Net program
    VB.Net program
    VB.Net PROGRAM VB.Net Hello World Example Let us look at a simple code that would print the words "Hello World" − I...

Translate

About Me

indian-choice
View my complete profile

Followers

  • Home
  • C++ PROGRAM
  • Java Program
  • VB.NET PROGRAM
  • ANDROID
  • SQL
  • Q&A
  • Books

BLOG

  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us

Copyright © BHAILOG PROGRAMMER | Powered by Bhailog Programmer
Design by Mohit and Pravin