0% found this document useful (0 votes)
11 views

Database SQL 065545

Uploaded by

anil uppati
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Database SQL 065545

Uploaded by

anil uppati
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 16

Different types of DBMS:

Oracle, MySQL, MongoDB, PostGre SQL, SQL Server, DB2 etc

SQL is required:
 To create new databases, tables and views
 To insert records in a database
 To update records in a database
 To delete records from a database
 To retrieve data from a database

What is Database?
A database is an organized collection of data, so that it can be easily
accessed and managed.

You can organize data into tables, rows, columns, and index it to make it
easier to find relevant information. Database handlers create a database in such a
way that only one set of software program provides access of data to
all the users.

The main purpose of the database is to operate a large amount of information


by storing, retrieving, and managing data. There are many dynamic websites on the
World Wide Web nowadays which are handled through databases.

For example, a model that checks the availability of rooms in a hotel.


It is an example of a dynamic website that uses a database. There are many
databases available like MySQL, Sybase, Oracle, MongoDB, Informix, PostgreSQL, SQL
Server, etc.

Modern databases are managed by the database management system (DBMS). SQL or
Structured Query Language is used to operate on the data stored in a database.

RDBMS Concepts
RDBMS stands for Relational Database Management System.
RDBMS is the basis for SQL, and for all modern database systems like MS SQL
Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
A Relational database management system (RDBMS) is a database management
system (DBMS) that is based on the relational model as introduced by E. F. Codd.

What is a table?
The data in an RDBMS is stored in database objects which are called as
tables.
This table is basically a collection of related data entries and it consists
of numerous columns and rows.
"Table" is another term for "relation"

SQL Syntax
SQL follows some unique set of rules and guidelines called syntax. Here, we
are providing all the basic SQL syntax:
 SQL is not case sensitive. Generally, SQL keywords are written in
uppercase.
 SQL statements are dependent on text lines. We can place a single SQL
statement on one or multiple text lines.
 You can perform most of the action in a database with SQL statements.
 SQL depends on relational algebra and tuple relational calculus. ( It is a
non-procedural query language which is based on finding a number of tuple
variables also known as range variable for which predicate holds true. It
describes the desired information without giving a specific procedure for obtaining
that information.)
SQL statements are started with any of the SQL commands/keywords like SELECT,
INSERT, UPDATE, DELETE, ALTER, DROP etc. and the statement ends with a semicolon
(;).

Example: SELECT "column_name" FROM "table_name";

Semicolon is used to separate SQL statements. It is a standard way to


separate SQL statements in a database system in which more than one SQL statements
are used in the same call.

Following are some of the important SQL commands:


SELECT: it extracts data from a database.
UPDATE: it updates data in database.
DELETE: it deletes data from database.
CREATE TABLE: it creates a new table.
ALTER TABLE: it is used to modify the table.
DROP TABLE: it deletes a table.
CREATE DATABASE: it creates a new database.
ALTER DATABASE: It is used to modify a database.
INSERT INTO: it inserts new data into a database.
CREATE INDEX: it is used to create an index (search key).
DROP INDEX: it deletes an index.

What Can SQL do?


SQL can execute queries against a database
SQL can retrieve data from a database
SQL can insert records in a database
SQL can update records in a database
SQL can delete records from a database
SQL can create new databases
SQL can create new tables in a database
SQL can create stored procedures in a database
SQL can create views in a database
SQL can set permissions on tables, procedures, and views

MySQL Data Types (Version 8.0)


Each column in a database table is required to have a name and a data type.

An SQL developer must decide what type of data that will be stored inside
each column when creating a table. The data type is a guideline for SQL to
understand what type of data is expected inside of each column, and it also
identifies how SQL will interact with the stored data.

In MySQL there are three main data types: String / Text, Numeric, and Date
and time.

String Data Types / Text Data Types

Data type Description

CHAR(size) A FIXED length string (can contain letters, numbers, and special
characters). The size parameter specifies the column length in characters -
can be from 0 to 255. Default is 1
VARCHAR(size) A VARIABLE length string (can contain letters, numbers, and
special characters). The size parameter specifies the maximum column length in
characters - can be from 0 to 65535
TINYTEXT Holds a string with a maximum length of 255 characters
TEXT(size) Holds a string with a maximum length of 65,535 bytes
MEDIUMTEXT Holds a string with a maximum length of 16,777,215 characters
LONGTEXT Holds a string with a maximum length of 4,294,967,295 characters

Numeric Data Types

Data type Description

BIT(size) A bit-value type. The number of bits per value is specified in


size. The size parameter can hold a value from 1 to 64. The default value for
size is 1.
TINYINT(size) A very small integer. Signed range is from -128 to 127.
Unsigned range is from 0 to 255. The size parameter specifies the maximum display
width (which is 255)
SMALLINT(size) A small integer. Signed range is from -32768 to 32767.
Unsigned range is from 0 to 65535. The size parameter specifies the maximum display
width (which is 255)
MEDIUMINT(size) A medium integer. Signed range is from -8388608 to 8388607.
Unsigned range is from 0 to 16777215. The size parameter specifies the maximum
display width (which is 255)
INT(size) A medium integer. Signed range is from -2147483648 to 2147483647.
Unsigned range is from 0 to 4294967295. The size parameter specifies the
maximum display width (which is 255)
INTEGER(size) Equal to INT(size)
BIGINT(size) A large integer. Signed range is from -9223372036854775808
to 9223372036854775807. Unsigned range is from 0 to 18446744073709551615. The size
parameter specifies the maximum display width (which is
255)
BOOL Zero is considered as false, nonzero values are considered as
true.
BOOLEAN Equal to BOOL
FLOAT(size, d) A floating point number. The total number of digits is
specified in size. The number of digits after the decimal point is specified in the
d parameter. This syntax is deprecated in MySQL 8.0.17, and
it will be removed in future MySQL versions
Double(,) A large number with floating decimal point
Decimal(,) A DOUBLE stored as a string , allowing for a fixed decimal point.
Choice for storing currency values.

Date and Time Data Types

Data type Description

DATE A date. Format: YYYY-MM-DD. The supported range is from '1000-01-


01' to '9999-12-31'
DATETIME(fsp) A date and time combination. Format: YYYY-MM-DD hh:mm:ss.
The supported range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. Adding
DEFAULT and ON UPDATE in the column definition to get
automatic initialization and updating to the current date and time
TIMESTAMP(fsp) A timestamp. TIMESTAMP values are stored as the number of
seconds since the Unix epoch ('1970-01-01 00:00:00' UTC).
Format: YYYY-MM-DD hh:mm:ss.
The supported range is from '1970-01-01 00:00:01' UTC to '2038-
01-09 03:14:07' UTC. Automatic initialization and updating to the
current date and time can be specified using DEFAULT CURRENT_TIMESTAMP
and ON UPDATE CURRENT_TIMESTAMP in the column definition
TIME(fsp) A time. Format: hh:mm:ss. The supported range is from '-
838:59:59' to '838:59:59'
YEAR A year in four-digit format. Values allowed in four-digit format:
1901 to 2155, and 0000.
MySQL 8.0 does not support year in two-digit format.
Apart from String, Numeric, Date and time data types there are some other Data
types are as below:
ENUM To store text value chosen from a list of predefined text values
SET This is also used for storing text values chosen from a list of
predefined text values. It can have multiple values. BOOL Synonym for TINYINT
(1), used to store Boolean values
BINARY Similar to CHAR, difference is texts are stored in binary
format.
VARBINARY Similar to VARCHAR, difference is texts are stored in binary
format.

SQL Commands
SQL commands are mainly categorized into five categories as discussed below:
• DDL
• DML
• DRL
• DCL
• TCL

DDL(Data Definition Language) :


DDL is abbreviation of Data Definition Language. It is used to create and
modify the structure of database objects in database.
DDL changes the structure of the table like creating a table, deleting a
table, altering a table, etc.
All the command of DDL are auto-committed that means it permanently save all
the changes in the database.
DDL is a set of SQL commands used to create, modify, and delete database
structures but not data. These commands are normally not used by a general user,
who should be accessing the database via an application
Here are some commands that come under DDL:

CREATE – Creates objects in the database


DROP – Deletes objects of the database
ALTER – Alters objects of the database
TRUNCATE – Deletes all records from a table and resets table identity to
initial value.

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

There are two CREATE statements available in SQL:


1. CREATE DATABASE
2. CREATE TABLE

i.CREATE DATABASE: A Database is defined as a structured set of data. So, in


SQL the very first step to store the data in a well structured manner is to create
a database.

The CREATE DATABASEstatement is used to create a new database in SQL.


Syntax
CREATE DATABASE databasename;

CREATE DATABASE Example


The following SQL statement creates a database called "testDB":

Example
CREATE DATABASE testDB;
ii.CREATE TABLE: The CREATE TABLE statement is used to create a table in SQL.
We know that a table comprises of rows and columns. So while creating tables we
have to provide all the information to SQL about the names of the columns,
type of data to be stored in columns, size of the data etc. Let us now dive into
details on how to use CREATE TABLE statement to create tables in SQL.

Syntax
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);

The column parameters specify the names of the columns of the table.
The datatype parameter specifies the type of data the column can hold (e.g.
varchar, integer, date, etc.).

CREATE TABLE Persons (


PersonID int(3),
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);

The PersonID column is of type int and will hold an integer.


The LastName, FirstName, Address, and City columns are of type varchar and
will hold characters, and the maximum length for these fields is 255 characters.

Create Table Using Another Table


A copy of an existing table can also be created using CREATE TABLE.

The new table gets the same column definitions. All columns or specific
columns can be selected.

If you create a new table using an existing table, the new table will be
filled with the existing values from the old table.

Syntax
CREATE TABLE new_table_name AS
SELECT column1, column2,...
FROM existing_table_name
WHERE ....;

CREATE TABLE TestTable AS


SELECT customername, contactname
FROM customers;

2)DROP – is used to delete objects from the database.

The DROP DATABASE statement is used to drop an existing SQL database.

Syntax
DROP DATABASE databasename;
Note: Be careful before dropping a database. Deleting a database will result
in loss of complete information stored in the database!

DROP DATABASE Example


The following SQL statement drops the existing database "testDB":

Example
DROP DATABASE testDB;

The DROP TABLE statement is used to drop an existing table in a database.

Syntax
DROP TABLE table_name;
Note: Be careful before dropping a table. Deleting a table will result in
loss of complete information stored in the table!

SQL DROP TABLE Example


The following SQL statement drops the existing table "Shippers":

Example
DROP TABLE Shippers;

3) SQL ALTER TABLE Statement

The ALTER TABLE statement is used to add, delete, or modify columns in an


existing table.
The ALTER TABLE statement is also used to add and drop various constraints on
an existing table.

ALTER TABLE - ADD Column


To add a column in a table, use the following syntax:

ALTER TABLE table_name


ADD column_name datatype;

The following SQL adds an "Email" column to the "Customers" table:

Example
ALTER TABLE Customers
ADD Email varchar(255);

ALTER TABLE - DROP COLUMN


To delete a column in a table, use the following syntax (notice that
some database systems don't allow deleting a column):

ALTER TABLE table_name


DROP COLUMN column_name;

The following SQL deletes the "Email" column from the "Customers"
table:

Example
ALTER TABLE Customers
DROP COLUMN Email;

ALTER TABLE - ALTER/MODIFY COLUMN


To change the data type of a column in a table, use the following
syntax:

ALTER TABLE table_name


ALTER COLUMN column_name datatype;

ALTER TABLE table_name


MODIFY COLUMN column_name datatype;

ALTER TABLE table_name


MODIFY column_name datatype;

ALTER TABLE - RENAME TO table name


It is used to rename the table
ALTER TABLE table_name
RENAME TO new_table_name

4) SQL TRUNCATE TABLE

The TRUNCATE TABLE statement is used to delete the data inside a table
including all spaces allocated for the records are removed, but not the table
itself.

Syntax
TRUNCATE TABLE table_name;

DML(Data Manipulation Language)


DML is abbreviation of Data Manipulation Language. It is used to store,
modify, delete, insert and update data in database.
DML commands are used to modify the database. It is responsible for all form
of changes in the database.
The command of DML is not auto-committed that means it can't permanently save
all the changes in the database. They can be rollback.
Here are some commands that come under DML:

INSERT - Inserts data into a table


UPDATE – Updates existing data into a table
DELETE – Deletes all records from a table

1) The SQL INSERT INTO Statement

The INSERT INTO statement is used to insert new records in a table.


INSERT INTO Syntax
It is possible to write the INSERT INTO statement in two ways:

A. Specify both the column names and the values to be inserted:

INSERT INTO table_name (column1, column2, column3, ...)


VALUES (value1, value2, value3, ...);

B. If you are adding values for all the columns of the table, you do not need
to specify the column names in the SQL query. However, make sure the order of the
values is in the same order as the columns in the table. Here, the INSERT
INTO syntax would be as follows:

INSERT INTO table_name


VALUES (value1, value2, value3, ...);

INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode,


Country)
VALUES ('Cardinal', 'Tom B. Erichsen', 'Skagen 21', 'Stavanger', '4006',
'Norway');

2) The SQL UPDATE Statement

The UPDATE statement is used to modify the existing records in a table.


UPDATE Syntax
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;

Note: Be careful when updating records in a table! Notice the WHERE clause in
the UPDATE statement. The WHERE clause specifies which record(s) that should be
updated. If you omit the WHERE clause, all records in the table will be
updated!

UPDATE Customers
SET ContactName = 'Alfred', City= 'Frankfurt'
WHERE CustomerID = 1;

UPDATE Multiple Records


It is the WHERE clause that determines how many records will be updated.
The following SQL statement will update the ContactName to "Juan" for all
records where country is "Mexico":

UPDATE Customers
SET ContactName='Juan'
WHERE Country='Mexico';

3)The SQL DELETE Statement

The DELETE statement is used to delete existing records in a table.

DELETE Syntax
DELETE FROM table_name WHERE condition;

Note: Be careful when deleting records in a table! Notice the WHERE clause in
the DELETE statement. The WHERE clause specifies which record(s) should be
deleted. If you omit the WHERE clause, all records in the table will be
deleted!

DELETE FROM Customers WHERE CustomerName='Alfreds';

Delete All Records


It is possible to delete all rows in a table without deleting the table. This
means that the table structure, attributes, and indexes will be intact:

DELETE FROM table_name;


The following SQL statement deletes all rows in the "Customers" table,
without deleting the table:

Example
DELETE FROM Customers;

Difference between Delete, Drop and Truncate:

DELETE Statement: The DELETE command is used to remove rows from a


table. A WHERE clause can be used to only remove some rows. If no WHERE condition
is specified, all rows will be removed. After performing a DELETE
operation you need to COMMIT or ROLLBACK the transaction to make the change
permanent or to undo it. Note that this operation will cause all DELETE
triggers on the table to fire.

TRUNCATE statement: TRUNCATE removes all rows from a table. The


operation cannot be rolled back and no triggers will be fired.

DROP statement: The DROP command removes a table from the database. All
the tables' rows, indexes and privileges will also be removed. No DML triggers
will be fired. The operation cannot be rolled back.

DRL/DSL(Data Retrieval Language/ Data Selection Language) :


• DRL/DSL stands for Data Retrieval Language/Data Selection Language.
• It is a set commands which are used to retrieve data from database server.
• It manipulates the data in database for display purpose like aggregate
function.
• In DRL/DSL, for accessing the data it uses the DML command that is SELECT.
• The SELECT command allows database users to retrieve the specific
information they desire from an operational database.

SELECT Syntax

SELECT column1, column2, ...FROM table_name;


SELECT CustomerName, City FROM Customers;

Here, column1, column2, ... are the field names of the table you want to
select data from. If you want to select all the fields available in the table, use
the following syntax:

SELECT * FROM table_name;

The SQL SELECT DISTINCT Statement

The SELECT DISTINCT statement is used to return only distinct (different)


values.
Inside a table, a column often contains many duplicate values; and sometimes
you only want to list the different (distinct) values.

SELECT DISTINCT Syntax

The SELECT DISTINCT statement is used to return only distinct (different)


values.
Inside a table, a column often contains many duplicate values; and sometimes
you only want to list the different (distinct) values.

SELECT DISTINCT column1, column2, ...FROM table_name;


SELECT DISTINCT Country FROM Customers;
SELECT COUNT(DISTINCT Country) FROM Customers;

The SQL WHERE Clause

The WHERE clause is used to filter records.


It is used to extract only those records that fulfill a specified condition.
Note: The WHERE clause is not only used in SELECT statements, it is also used
in UPDATE, DELETE, etc.!

WHERE Syntax

SELECT column1, column2, ...


FROM table_name
WHERE condition;

SELECT * FROM Customers


WHERE Country='Mexico';
SELECT clause has many optional clauses are as follow;

Clause Description

FROM It is used for selecting a table name in a database.


WHERE It specifies which rows to retrieve.
GROUP BY It is used to arrange the data into groups.
HAVING It selects among the groups defined by the GROUP BY clause.
ORDER BY It specifies an order in which to return the rows.
AS It provides an alias which can be used to temporarily rename
tables or columns.

DCL(Data Control Language)


DCL includes commands such as GRANT and REVOKE which mainly deals with the
rights, permissions and other controls of the database system.
Examples of DCL commands:

1)GRANT-gives user’s access privileges to database.


2)REVOKE-withdraw user’s access privileges given by using the GRANT command.

• Allow a User to create session


When we create a user in SQL, it is not even allowed to login and create a
session until and unless proper permissions/priviliges are granted to the user.
Following command can be used to grant the session creating priviliges.

GRANT CREATE SESSION TO username;

• Allow a User to create table


To allow a user to create tables in the database,
we can use the below command,

GRANT CREATE TABLE TO username;

• Provide user with space on tablespace to store table


Allowing a user to create table is not enough to start storing data in that
table.
We also must provide the user with priviliges to use the available tablespace
for their table and data.

ALTER USER username QUOTA UNLIMITED ON SYSTEM;

The above command will alter the user details and will provide it access to
unlimited tablespace on system.

NOTE: Generally unlimited quota is provided to Admin users.

• Grant permission to create any table


Sometimes user is restricted from creating come tables with names which are
reserved for system tables. But we can grant privileges to a user to create any
table using the below command,

GRANT CREATE ANY TABLE TO username

• Grant permission to drop any table


As the title suggests, if you want to allow user to drop any table from the
database, then grant this privilege to the user,
GRANT DROP ANY TABLE TO username

• To take back Permissions


And, if you want to take back the privileges from any user, use the REVOKE
command.

REVOKE CREATE TABLE FROM username

TCL
TCL is abbreviation of Transactional Control Language. It is used to manage
different transactions occurring within a database.
TCL commands can only use with DML commands like INSERT, DELETE and UPDATE
only.
These operations are automatically committed in the database that's why they
cannot be used while creating tables or dropping them.
Here are some commands that come under TCL:

COMMIT – Saves work done in transactions

Syntax:

COMMIT;

Example:

DELETE FROM CUSTOMERS


WHERE AGE = 25;

COMMIT;

ROLLBACK – Restores database to original state since the last COMMIT command
in transactions

Syntax:

ROLLBACK;

Example:

DELETE FROM CUSTOMERS


WHERE AGE = 25;
ROLLBACK;

SAVE TRANSACTION – Sets a savepoint within a transaction. It is used to roll


the transaction back to a certain point without rolling back the entire
transaction.

Syntax:

SAVEPOINT SAVEPOINT_NAME;

INSERT INTO class VALUES(5, 'Rahul');


COMMIT;
UPDATE class SET name = 'Abhijit' WHERE id = '5';
SAVEPOINT A;
INSERT INTO class VALUES(6, 'Chris');
SAVEPOINT B;
INSERT INTO class VALUES(7, 'Bravo');
SAVEPOINT C;
SELECT * FROM class;
ROLLBACK TO B;
SELECT * FROM class;

Types of Expression:
1) Boolean Expression: SQL Boolean Expressions are SQL expressions that only
return Boolean Datatype as a result. These expressions can be of two types −

Boolean Expressions that check for equality of two values using SQL
comparison operators. Here, equality of these values is a condition.

Boolean Expressions can also contain one value paired with an SQL
logical operator. In this case, the logic specified acts like a condition.

They return either TRUE, FALSE or UNKNOWN as the result. If the


condition is met, these expressions return TRUE; and FALSE otherwise. UNKNOWN is
returned when operands in the expression are NULL values.

Syntax:
SELECT column1, column2, columnN
FROM table_name
WHERE BOOLEAN EXPRESSION;

Example:
SELECT * FROM CUSTOMERS WHERE SALARY = 10000;

2) Numeric Expression: Numeric expressions are comprised of two operands and


an SQL Arithmetic Operator. These expressions are used to perform any mathematical
operation in any query. Hence, the operands must always be numerals and the
return value will always be a number as well.

Syntax
SELECT numerical_expression as OPERATION_NAME
FROM table_name
WHERE NUMERICAL EXPRESSION ;

Example:
1) SELECT (15 + 6) AS ADDITION
2) SELECT COUNT(*) AS "RECORDS" FROM CUSTOMERS;
3) SELECT SUM(column_name) FROM table_name WHERE condition;
4) SELECT COUNT(ProductID) FROM Products;
5) SELECT AVG(Price) FROM Products;

3) Date Expressions: Date Expressions are used to compare date related values
with current system date and time values.

For instance, in a manufacturing company, items manufactured per year


can be segregated by using date expressions in a WHERE clause. Counting from the
first day of an year to the last day, the count of each item will be
retrieved; once the required information is gathered, the company can use this
information for their own purposes.

Syntax:
SELECT column_name(s)
FROM table_name
WHERE DATE EXPRESSION ;

Example:
1) SELECT CURRENT_TIMESTAMP;
2) SELECT DATE FROM ORDERS WHERE DATE < '2008/06/01';
3) SELECT * FROM Orders WHERE OrderDate='2008-11-11'

Executing Queries:
Statement objects allow you to execute basic SQL queries and retrieve the
results through the ResultSet class, which is described later.
To create a Statement instance, you call the createStatement() method on the
Connection object you have retrieved using one of the DriverManager.getConnection
() or DataSource.getConnection() methods described earlier.

Once you have a Statement instance, you can execute a SELECT query by calling
the executeQuery(String) method with the SQL you want to use.
To update data in the database, use the executeUpdate(String SQL) method.
This method returns the number of rows matched by the update statement, not the
number of rows that were modified.

If you do not know ahead of time whether the SQL statement will be a SELECT
or an UPDATE/INSERT, then you can use the execute(String SQL) method. This method
will return true if the SQL query was a SELECT, or false if it was an UPDATE,
INSERT, or DELETE statement. If the statement was a SELECT query, you can
retrieve the results by calling the getResultSet() method. If the statement
was an UPDATE, INSERT, or DELETE statement, you can retrieve the affected rows
count by calling getUpdateCount() on the Statement instance.

package com.java2novice.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class MyExecuteMethod {
public static void main(String a[]){
Connection con = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.
getConnection("jdbc:oracle:thin:@<hostname>:<port num>:<DB name>"
,"user","password");
Statement stmt = con.createStatement();
//The query can be update query or can be select query
String query = "select * from emp";
boolean status = stmt.execute(query);
if(status){
//query is a select query.
ResultSet rs = stmt.getResultSet();
while(rs.next()){
System.out.println(rs.getString(1));
}
rs.close();
} else {
//query can be update or any query apart from select query
int count = stmt.getUpdateCount();
System.out.println("Total records updated: "+count);
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
try{
if(con != null) con.close();
} catch (Exception ex){}
}
}
}

Practice Session
1) Create table Person Having column personID, Name, DOB, Salary
create table person (
personID int,
Name varchar(255),
DOB date,
salary decimal
);
2) Add columns "Email_ID" in to table Person
ALTER TABLE person
Add Email_ID varchar(60);
3) Insert value 1, Edubridge, 19-02-1988, 1000.00, [email protected] into table
Person
4) write a query to update the name Edubridge with your name

SQL language (Structured Query Lanuguage)

SQL Server DBMS - SQL language (HDFC Bank - Saving acc, Credit acc, Loan acc)

Database 1 - Saving acc


Table1 - personal
record1
Table2 - Trancation detail
table3....

Database 2 - Credit acc


Table1
Table2
Table3
Database 3 - Loan acc
Table1
Table2
Table3

MySQL Server DBMS - SQL language(HDFC - Saving acc, Current Acc, Credit card Acc)

Database1 - Saving acc

Table1 - personal info(rows/columns )

Data/records

Table2 - transaction detail

Table3 - statement

Database2 - Current acc

table1
rows/columns
data/records
Table2
Table3

Database3 - credit card acc

You might also like