SQL DBA SQL statement for creating table space Syntax CREATE TABLESPACE <TablespaceName> DATAFILE ‘<Datafile Path>’ SIZE 100M AUTOEXTEND ON MAXSIZE UNLIMITED ; Example CREATE TABLESPACE TUTORIALTBS DATAFILE ‘C:oraclexeoradataXETUTORIALTBS.DBF’ SIZE 100M AUTOEXTEND ON MAXSIZE UNLIMITED ; SQL statement for alter table space — ADD DATAFILE Syntax ALTER TABLESPACE <TablespaceName> ADD DATAFILE ‘<Datafile Path>’ SIZE 4G […]
Category: SQL Queries
SQL RENAME
SQL RENAME By using RENAME command, we can rename a table. The rename operation is done automatically. Which means that no other thread can access any of the tables while the rename processing is running. Syntax RENAME <TableName> TO <NewTAbleName>; Example RENAME EMPLOYEE TO EMPLOYEE_DETAILS; NarayanaswamyHello! I am Narayanaswamy founder and admin of narayanatutorial.com. […]
SQL ALTER
SQL ALTER The structure of the table can be modified by using ALTER TABLE command. ALTER TABLE works by making a temporary copy of the original table. The alteration is performed on the copy, then the original table is deleted and the new one is renamed. ALTER TABLE changing the structure of an existing table […]
SQL UPDATE
SQL UPDATE The UPDATE command is used to change or update data values in a table. UPDATE all rows one column Syntax UPDATE <TableName> SET <ColumnName 1>=<Expression> or <Value> Example UPDATE EMPLOYEE SET COUNTRY=”INDIA”; UPDATE all rows more than one column Syntax UPDATE <TableName> SET <ColumnName 1>=<Expression> or <Value>, <ColumnName 2>=<Expression> or <Value> Example UPDATE […]
SQL DELETE
SQL DELETE OPERATIONS The DELETE command deletes rows from the table that satisfies the condition provided by its WHERE clause and returns the number of records are deleted. If the DELETE command without a WHERE clause is issued then, all rows are deleted. We can retrieve the deleted records back if we had not executed […]
SQL INSERT
SQL INSERT DATA INTO A TABLE FROM ANOTHER TABLE We can insert data into table in two different ways. They are 1) Using INSERT INTO without using SELECT statement. Syntax INSERT INTO <TableName>(<ColumnName1>,<ColumnName2>) VALUES (<ColumnValue1>,<ColumnValue2>); Example INSERT INTO EMPLOYEE (FIRSTNAME, LASTNAME) VALUES (‘Narayana’,’Ragi’); 2) Using INSERT INTO with SELECT statement Syntax INSERT INTO <TableName> SELECT […]
SQL CREATE
SQL CREATE TABLE FROM ANOTHER TABLE We can create tables two ways they are 1) Using CREATE TABLE by specifying columns names, columns data types, columns data length. Syntax: CREATE TABLE <TableName> ( <ColumnName1> <DataType>(Length), <ColumnName2> <DataType>(Length)); Example CREATE TABLE EMPLOYEE (NAME Varchar2(20), ID Number(10)); 2) Using CREATE TABLE statement for target table and SELECT […]
SQL ORDER BY
SQL ORDER BY Oracle allow data from a table to be viewed in a sorted order. The rows retrieved from the table will be sorted in either ascending or descending order depending on the condition specified in the SELECT statement. Syntax SELECT * FROM <TableName> ORDER BY <ColumnName1>,<ColumnName2> <[Sort Order]> The ORDER BY clause will […]
SQL DISTINCT
In this tutorial post, we are going discussing how to Eliminating Duplicate Records from the table. SQL DISTINCT The table could have duplicate row. In such case how to view only unique rows i.e distinct rows to achieve it DISTINCT clause can be used. The DISTINCT clause can be used to removing duplicate records from […]
SQL WHERE
SQL WHERE Statement In this tutorial post, we are going to discussing SQL WHERE statement in oracle data base. Oracle provides the option of using WHERE statement in an SQL query to apply a filter on the rows retrieved. When a WHERE clause is added to the SQL query, then query executing as follows. The […]