You are on page 1of 42

SOURCE CODE:

SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate


FROM Orders INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID;
INNER JOIN / NATURAL JOIN
SOURCE CODE:
SQL> select id,name,age,salary from customer,orders where customer.id=orders.cid;

OUTPUT:
ID NAME AGE SALARY
101 Ramua 20 2000

102 Dhivya 21 2300

103 Srividya 22 3000

104 Priya 19 2500

105 Gayathri 24 3200


LEFT JOIN:

SOURCE CODE:

SQL> select id,name,salary,odate from customer LEFT JOIN orders ON


customer.id=orders.cid;

OUTPUT:

ID NAME SALARY ODATE


101 Ramya 2000 29-DEC-18
102 Dhivya 2300 10-NOV-18
103 Srividhya 3000 10-SEP-18
104 Priya 2500 15-APR-18

105 Gayathri 3200 NULL

RIGHT JOIN:

SOURCE CODE:
SQL> select id,name,salary,odate from customer RIGHT JOIN orders ON
customer.i d=orders.cid;
OUTPUT:
ID NAME SALARY ODATE
101 Ramya 2000 29-DEC-18

102 Dhivya 2300 10-NOV-18

103 Srividhya 3000 10-SEP-18

104 Priya 2500 15-APR-18


NULL NULL NULL 24-NOV-17
FULL JOIN:
SOURCE CODE:

SQL> select id,name,salary,odate from customer FULL JOIN orders ON customer.id


=orders.cid;
OUTPUT:
ID NAME SALARY ODATE

101 Ramya 2000 29-DEC-18

102 Dhivya 2300 10-NOV-18

103 Srividhya 3000 10-SEP-18

104 Priya 2500 15-APR-18

105 Gayathri 3200 NULL

NULL NULL NULL 24-NOV-17


6 rows selected.
CARTESIAN/CROSS
JOIN:
SOURCE CODE:
SQL> select id,name,salary,odate from customer,orders;

OUTPUT:
ID NAME SALARY ODATE
101 Ramya 2000 29-DEC-18
101 Ramya 2000 10-NOV-18
101 Ramya 2000 10-SEP-18
101 Ramya 2000 15-APR-18
101 Ramya 2000 24-NOV-17
102 Dhivya 2300 29-DEC-18
102 Dhivya 2300 10-NOV-18
102 Dhivya 2300 10-SEP-18
102 Dhivya 2300 15-APR-18
102 Dhivya 2300 24-NOV-17

103 Srividhya 3000 29-DEC-18


103 Srividhya 3000 10-NOV-18
103 Srividhya 3000 10-SEP-18
103 Srividhya 3000 15-APR-18
103 Srividhya 3000 24-NOV-17
104 Priya 2500 29-DEC-18
104 Priya 2500 10-NOV-18
104 Priya 2500 10-SEP-18
104 Priya 2500 15-APR-18
104 Priya 2500 24-NOV-17
105 Gayathri 3200 29-DEC-18

105 Gayathri 3200 10-NOV-18

105 Gayathri 3200 10-SEP-18

105 Gayathri 3200 15-APR-18

105 Gayathri 3200 24-NOV-17


25 rows selected.

UNION:

SOURCE CODE:
SQL> select id,name,salary,odate from customer left join orders on customer.id=orders.cid
UNION select id,name,salary,odate from customer RIGHT join orders1 5 on
customer.id=orders.cid;
OUTPUT:

ID NAME SALARY ODATE


101 Ramya 2000 29-DEC-18

102 Dhivya 2300 10-NOV-18


103 Srividhya 3000 10-SEP-18
104 Priya 2500 15-APR-18
105 Gayathri 3200 NULL
NULL NULL NULL 24-NOV-17
6 rows selected.

UNION ALL:

SOURCE CODE:
SQL> select id,name,salary,odate from customer left join orders on customer.id
=orders.cid UNION ALL select id,name,salary,odate from customer RIGHT join orders15
on customer.id=orders.cid;
OUTPUT:
ID NAME SALARY ODATE
101 Ramya 2000 29-DEC-18
102 Dhivya 2300 10-NOV-18
103 Srividhya 3000 10-SEP-18
104 Priya 2500 15-APR-18

105 Gayathri 3200 NULL

101 Ramya 2000 29-DEC-18


102 Dhivya 2300 10-NOV-18
103 Srividhya 3000 10-SEP-18
104 Priya 2500 15-APR-18
NULL NULL NULL 24-NOV-17
10 rows selected.

SOURCE CODE:
Table1: Customer
SQL> create table customer(id int,name varchar(20),age int,address
varchar(20),salary float); Table created.
SQL> select * from customer;
OUTPUT:

ID NAME AGE ADDRESS SALARY


101 Ramya 20 Delhi 2000
102 Dhivya 21 Bombay 2300
103 Srividhy 22 Karnataka 3000
a
104 Priya 19 Chennai 2500
105 Gayathri 24 Kerala 3200
ID NAME AGE ADDRESS SALARY

SOURCE CODE:

Table2: Orders

SQL> create table orders(oid int,odate date,cid int,amount float);


Table created.
SQL> select * from orders;

OUTPUT:
OID ODATE CID AMOUNT
1 29-DEC-18 101 2000
2 10-NOV-18 102 2300
3 10-SEP-18 103 3000
4 15-APR-18 104 2000
6 24-NOV-17 107 2000

AGGREGATE FUNCTION:
SOURCE CODE:

SQL> select count(*)from customer;

OUTPUT:
Count(*)

5
SOURCE CODE:

SQL> select max(salary)from customer;


OUTPUT:
MAX(SALARY)

3200

SOURCE CODE:

SQL> select min(salary)from customer;

OUTPUT:

MIN(SALARY)

2000

SOURCE CODE:
SQL> select avg(salary)from customer;

OUTPUT:
AVG(SALARY)

2500

SOURCE CODE:

SQL> select sum(salary)from customer;

OUTPUT:
SUM(SALARY)

13000

SUBQUERIES:

SOURCE CODE:
SQL> select * from customer where id IN(select id from customer where salary>2000);

OUTPUT:
ID NAME AGE ADDRESS SALARY
102 Dhivya 21 Bombay 2300

103 Srividhya 22 Karnataka 3000

104 Priya 19 Chennai 2500

105 Gayathri 24 Kerala 3200

SOURCE CODE:

SQL> select * from customer where id NOT IN(select id from customer where salary>2000);

OUTPUT:
ID NAME AGE ADDRESS SALARY

101 Ramya 20 Delhi 2000

CREATING VIEW FROM A SINGLE


TABLE: QUERY:
SQL>CREATE VIEW DetailsView AS SELECT NAME, ADDRESS FROM Student
Details WHERE S_ID < 5;
SQL> SELECT * FROM DetailsView;
OUTPUT:
NAME ADDRESS

Harish Kolkata

Ashish Durgapur

Pratik Delhi

Dhanraj Bihar

CREATING VIEW FROM MULTIPLE TABLES:

Query:
SQL>CREATE VIEW MarksView AS
SELECT StudentDetails.NAME, StudentDetails.ADDRESS, StudentMarks.MARKS FROM
StudentDetails, StudentMarks WHERE StudentDetails.NAME =StudentMarks.NAME;
SQL>SELECT * FROM MarksView;

OUTPUT:
NAME ADDRESS MARKS

Harsh Kolkata 90

Pratik Delhi 80

Dhanraj Bihar 95

Ram Rajasthan 85
CREATE OR REPLACE VIEW:

Syntax:
CREATE OR REPLACE VIEW view_name AS SELECT column1,coulmn2,..
FROM table_name WHERE condition;
Query:
SQL>CREATE OR REPLACE VIEW MarksView AS SELECT StudentDetails.NAME,
StudentDetails.ADDRESS, StudentMarks.MARKS, StudentMarks.AGE FROM
StudentDetails, StudentMarks WHERE StudentDetails.NAME = StudentMarks.NAME;
SQL> SELECT * FROM MarksView;

OUTPUT:
NAME ADDRESS MARKS AGE

Harsh Kolkata 90 19

Partik Delhi 80 19
Dhanraj Bihar 95 21

Ram Rajasthan 85 18
INSERTING A ROW IN A VIEW:

Syntax:

INSERT INTO view_name(column1, column2 , column3,..) VALUES(value1, value2,


value3..);

Query:
SQL>INSERT INTO DetailsView(NAME, ADDRESS)
VALUES("Suresh","Gurgaon"); SQL>SELECT * FROM DetailsView;

OUTPUT:

NAME ADDRESS

Harsh Kolkata

Ashish Durgapur

Pratik Delhi

Dhanraj Bihar

Suresh Gurgaon

DELETING A ROW FROM A VIEW:

Syntax:
DELETE FROM view_name WHERE condition;

Query:
DELETE FROM DetailsView WHERE NAME="Suresh";

SELECT * FROM DetailsView;

OUTPUT:
NAME ADDRESS

Harsh Kolkata

Ashish Durgapur

Partik Delhi

Dhanraj Bihar
Query:
SQL>CREATE TABLE students (ID number(10), NAME char(20));
Now insert values into table
SQL> INSERT into students VALUES(sequence_1.nextval,'Rajesh'); INSERT into students
VALUES(sequence_1.nextval,'Suresh');
OUTPUT:

ID NAME
1 Rajesh
2 Suresh

Query:
SQL>CREATE SYNONYM Geektabl FOR Server1.GFG.Geeeksh.Geektab; GO
Find the output in Server2 by using synonym.
SQL>SELECT ID, Name FROM Geektable;

OUTPUT :
ID NAME

1 Nisha
2 Mira
3 Punit
4 Ram

Program :
DECLARE
total_rows number(2);
BEGIN
UPDATE customers
SET salary = salary + 500;
IF sql%notfound THEN dbms_output.put_line('no customers selected');
ELSIF sql%found THEN
total_rows := sql
%rowcount;
dbms_output.put_line( total_rows || ' customers selected ');
END
IF;
END
;
/

OUTPUT:
6 customers selected
PL/SQL procedure successfully completed.
SQL>Select * from customers;

ID NAME AGE ADDRESS SALARY


1 Ramesh 32 Ahmadabad 2000.00

2 Khilan 25 Delhi 1500.00


3 Kaushik 23 Kota 2000.00
4 Chaitali 25 Mumbai 6500.00
5 Hardik 27 bhopal 8500.00
6 Komal 22 MP 4500.00

EXPLICIT CURSORS:

DECLARE
c_id customers.id%type;
c_name customer.name
%type; c_addr
customers.address%type;
CURSOR c_customers is
SELECT id, name, address
FROM customers; BEGIN
OPEN
c_customers;
LOOP
FETCH c_customers into c_id, c_name,
c_addr; EXIT WHEN c_customers
%notfound;
dbms_output.put_line(c_id || '' || c_name || '' ||
c_addr); END LOOP;
CLOSE
c_customers;
END;
/Output:

ID NAME ADDRESS
1 Ramesh Ahmadabad
2 Khilan Delhi
3 Kaushik Kota
4 Chaitali Mumbai
5 Hardik bhopal
6 Komal MP

PROGRAM:
set serveroutput on;

CREATE OR REPACE PROCEDURE Sum(a IN number, b IN number) IS c number;


BEGIN

c := a+b;
dbms_output.put_line('Sum of two nos= '|| c); END Sum;

OUTPUT:
Procedure created.
For calling the procedure created following code will be executed:
set serveroutput on; DECLARE
x
num
ber;
y
num
ber;

BEGIN

x := &x;
y := &y; Sum(x,y);
END;

OUTPUT:
Enter value for x: 10

Enter value for y: 20 Sum of two nos= 30

PL/SQL procedure successfully created.

PROGRAM:

set serveroutput on;

CREATE OR REPLACE FUNCTION Sum(a IN number, b IN number) RETURN Number


IS c number; BEGIN

c := a+b;
RETURN c;

END;
OUTPUT:
Function Created.

For calling the function Sum following code will be executed:


set serveroutput
on; DECLARE

no1
number;
no2
number;
result
number;

BEGIN

no1 :=
&no1;
no2 :=
&no2;
result := Sum(no1,no2);
dbms_output.put_line(‘Sum of two nos=’||result);
END;
OUTPUT:
Enter value for
no1:5 Enter
value for no2:5

Sum of two nos=10

PL/SQL procedure successfully created.

PROGRAM:
create or replace trigger up_classd before update on customer for
each row DECLARE
BEGIN
if updating then
DBMS_OUTPUT.PUT_LINE(&#39;new value
is&#39;||:new.stotal); DBMS_OUTPUT.PUT_LINE(&#39;old
value is&#39;||:old.stotal);
end if;
END;
OUTP
UT:

SQL&gt;/Trigger created.
SQL&gt; select * from customer;
SID SNAME SALARY

1 Aarthi 300

2 Ramya 500

3 Sakthi 670

SQL&gt; update customer set salary=500 where


sid=&#39;1&#39;; new value is500
old value is300
SQL&gt; select * from customer;

SID SNAME STOTAL

1 Aarthi 500

2 Ramya 500
3 Skathi 670

TRIGGER CREATED DURING DELETION:


create or replace trigger del_classb before delete on customer for
each row DECLARE
BEGIN
if deleting then
DBMS_OUTPUT.PUT_LINE(&#39;row
deleted&#39;); end if;
END;

OUTPUT:
Trigger created.
SQL&gt; delete from customer
where sid=1; row deleted
1 row deleted.
SQL&gt; select * from customer;

SID SNAME STOTAL


2 Ramya 500
3 Skathi 670

TRIGGER CREATED DURING INSERTION:


create or replace trigger ins_classb before insert on classb for each row
DECLARE
InvTOt
exception;
BEGIN
if inserting then
if:new.stotal&gt;1000
then raise InvTot;
end if;
end if;
EXCEPTION
when InvTot then
raise application error(-20000,&#39;Total not valid&#39;);
END;

OUTPUT:
SQL&gt;/ Trigger created.
SQL&gt; select * from classb;

SID SNAME SDEPT STOTAL GRADE

1 Ramya IT 450

2 Ezhil IT 460

3 Sathya ECE 900

4 Sakthi CSE 450

SQL&gt; insert into classb


values(&#39;5&#39;,&#39;vino&#39;,&#39;it&#39;,&#39;500&#39;,&#39;a&#3;);
1 row created.

SQL&gt; insert into classb


values(&#39;6&#39;,&#39;jana&#39;,&#39;it&#39;,&#39;20000&#39;,&#39;a&#39;);

insert into classb


values(&#39;6&#39;,&#39;jana&#39;,&#39;it&#39;,&#39;20000&#39;,&#39;a&#39;)
ERROR at line 1:
ORA-20000: Total not valid
ORA-06512: at &quot;SCOTT.INS_CLASSB&quot;, line 11
ORA-04088: error during execution of trigger &#39;SCOTT.INS_CLASSB&#39;

PROGRAM:
SQL&gt;declare
2 c_id customer.id%type:=5;
3 c_name customer.name%type;
4 c_addr customer.address%type;
5 begin
6 select name,address into
c_name,c_addr 7 from customer
8 where id=c_id;
9 dbms_output.put_line(&#39;name:&#39;||c_name);
10 dbms_output.put_line(&#39;address:&#39;||c_addr);
11 exception
12 when no_data_found then
13 dbms_output.put_line(&#39;no such customer!
&#39;); 14 when others then
15 dbms_output.put_line(&#39;error!&#39;);
16 end;
17 /
Pre-defined Exceptions
SQL&gt; select * from customer;

ID NAME AGE ADDRESS SALARY

1 Ezhil 23 aaa 20000

2 Aarthi 24 bbb 30000

3 Sumathi 21 ccc 35000

4 Viji 24 ddd 40000


5 Priya 21 eee 43000
--6 rows selected.

Output:
name :priya
address : eee
PL/SQL procedure successfully completed.

User-defined Exceptions
DECLARE
c_id customers.id%type :=
&amp;cc_id; c_name
customers.name%type;
c_addr customers.address%type;
-- user defined
exception ex_invalid_id
EXCEPTION; BEGIN
IF c_id &lt;= 0
THENRAISE
ex_invalid_id;
ELSE
SELECT name, address INTO c_name,
c_addr FROM customers
WHERE id = c_id;
DBMS_OUTPUT.PUT_LINE (&#39;Name: &#39;|| c_name);
DBMS_OUTPUT.PUT_LINE (&#39;Address: &#39; || c_addr); END IF;
EXCEPTION
WHEN ex_invalid_id THEN
dbms_output.put_line(&#39;ID must be greater than zero!&#39;);
WHEN no_data_found THEN
dbms_output.put_line(&#39;No such customer!
&#39;); WHEN others THEN
dbms_output.put_line(&#39;Error!&#39;);
END;
/

OUTPUT:
Enter value for cc_id: -6 (let&#39;s enter a value -6) old 2: c_id customers.id%type :=
&amp;cc_id;
new 2: c_id customers.id
%type := -6; ID must be greater
than zero!
PL/SQL procedure successfully completed.
Double click on Button to open code window

To create Database in SQL Server


● Click on Solution Explorer -> Add new item -> SQL Server Database
● Give database name -> Click Add button
Server Explore will open

Right click on table -> Add new table


Give Table name
Open Web.config File

● Give your database pat


connectionString="DataSource=.\SQLEXPRESS;AttachDbFilename=E:\iTechFest\
WebSite2\A pp_Data\Test.mdf;Integrated Security=True; User Instance=True"

To insert Record:
Include Header file
using System;
using System.Data;
using System.
Configuration; using
System. Collections;
using System. Web;
using System.
Web.Security; using
System. Web.UI;
using System. Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System. Web.UI.HtmlControls;
using System.
Data.SqlClient;
using System. IO;
Declare Variables
string connstr =
ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString();
SqlConnection conn = new SqlConnection();
string strQuery;
SqlCommand
cmd;
SqlDataAdapter sda = new SqlDataAdapter();
In Button -> Click function
conn.ConnectionString =
connstr; conn.Open();
string insertquery = "insert into Sample (ID,Name) values (@ID,@Name)"; cmd = new
SqlCommand(insertquery, conn); cmd.Parameters.AddWithValue("@ID", TextBox1.Text );
cmd.Parameters.AddWithValue("@Name", TextBox2.Text );
cmd.ExecuteNonQuery();
TextBox1.Text = "";

TextBox2.Text = "";
TextBox1.Focus();
Output
CREATE A TABLE IN ORACLE
SQL>create table account(cname varchar(20),accno number(10),balance
number); Table Created

SQL> insert into account values('&cname',&accno,&balance); Enter value for cname: Mathi

Enter value for accno: 1234


Enter value for balance:
10000

old 1: insert into account values('&cname',&accno,&balance)


new 1: insert into emp values('Mathi',1234,10000) 1 row
created. SOURCE CODE FOR FORM1

Private Sub
ACCOUNT_Click()
Form2.Show

End Sub

Private
Sub
EXIT_C
lick()
Unload
Me End
Sub

Private Sub
TRANSACTION_C
lick()

Form3.
Show
End
Sub

SOURCE CODE FOR FORM 2


Private Sub
CLEAR_Click()
Text1.Text = ""

Text2.Text = "" Text3.Text = "" End Sub Private Sub

DELETE_Click()
Adodc1.Recordset.DELETE MsgBox "record deleted"
Adodc1.Recordset.MoveNext If Adodc1.Recordset.EOF =
True Then Adodc1.Recordset.MovePrevious

End If End Sub

Private Sub
EXIT_Click()
Unload Me

End
Sub
Private
Sub
HOME
_Click()
Form1.
Show
End
Sub
Private
Sub

INSERT_Click()
Adodc1.Recordset.AddNew End Sub

Private Sub TRANSACTION_Click()

Form3.Show

End
Sub
Private Sub UPDATE_Click() Adodc1.Recordset.UPDATE MsgBox "record
updated successfully"

End Sub
SOURCE CODE FOR FORM 3
Private Sub
ACCOUNT_Click()
Form2.Show

End Sub
Private Sub
CLEAR_Click()
Text1.Text = ""

Text2.Text = "" End Sub Private Sub

DEPOSIT_Click()
Dim s As String s = InputBox("enter the amount to be deposited")
Text2.Text = Val(Text2.Text) + Val(s) A = Text2.Text MsgBox "CURRENT BALANCE
IS Rs"
+ Str(A) Adodc1.Recordset.Save
Adodc1.Recordset.UPDATE End Sub

Private Sub EXIT_Click() Unload Me End Sub Private Sub HOME_Click()

Form1.Sh
ow End
Sub
Private
Sub

WITHDRAW_Click()
Dim s As String s = InputBox("enter the amount to be deleted")
Text2.Text = Val(Text2.Text) - Val(s) A = Text2.Text MsgBox "current balance is Rs" +
Str(A) Adodc1.Recordset.Save

Adodc1.Recordset.U
PDATE End Sub
Output
SYNTAX:
Import MySQL. Connector
Db_connection=mysql.connector.connect ( Host=”hostname”,User=”username”,
Passwd=”password” )
EXAMPLE:
Import MySQL. Connector
Db_connection = mysql.connector.connect ( Host=”localhost”,User=”root”, Passwd=”root”)
Print (db_connection)
OUTPUT:

<Mysql.connector.connection.mySQLconnection object at 0x000002338A4C6B00>

Here OUTPUT shows the connection created successfully Creating Database in MySQL
using Python:

SYNTAX:

CREATE DATABASE “database_name”

Create database using Python in MySQL:


Import MySQL. Connector
db_connection = mysql.connector.connect ( Host= "localhost",User= "root", Passwd="root")

# creating database_cursor to perform SQL operation


db_cursor = db_connection.cursor ()

# executing cursor with execute method and pass SQL QUERY db_cursor.execute
("CREATE DATABASE my_first_db")
# get list of all databases db_cursor.execute ("SHOW DATABASES") #print all databases
For db in db_cursor:

Print (db)

OUTPUT

SYNTAX:

CREATE TABLE student (id INT, name VARCHAR(255))


Example:
Import MySQL. Connector
db_connection = mysql.connector.connect ( Host="localhost",

User="root",
Passwd="root", Database="my_first_db")

db_cursor = db_connection.cursor ()
#here creating database table as student'

db_cursor.execute ("CREATE TABLE student (id INT, name VARCHAR (255))") #Get
database table'

db_cursor.execute ("SHOW
TABLES") For table in db_cursor:

Print (table)
OUTPUT:

(‘Student',)

Create a Table with Primary Key:


Let's create an Employee table with three different columns. We will add a primary key in id
column with AUTO_INCREMENT constraint SYNTAX:

CREATE TABLE employee(id INT AUTO_INCREMENT PRIMARY KEY, name


VARCHAR(255), salary INT(6))
Example:
Import MySQL. Connector
db_connection = mysql.connector.connect ( Host="localhost",User="root", passwd="root",
Database="my_first_db")
db_cursor = db_connection.cursor ()
#here creating database table as employee with primary key
db_cursor.execute ("CREATE TABLE employee(id INT AUTO_INCREMENT P
RIMARY KEY, name VARCHAR(255), salary INT(6))")
#Get database table
db_cursor.execute ("SHOW TABLES") For table in db_cursor:
Print (table)
OUTPUT:
(‘Employee',) (‘Student',)
ALTER table in MySQL with Python:
Alter command is used for modification of Table structure in SQL. Here
we will alter Student table and add a primary key to the id field.

SYNTAX
ALTER TABLE student MODIFY id INT PRIMARY KEY
Example,
Import MySQL. Connector
db_connection = mysql.connector.connect (Host="localhost",User="root", passwd="root",
Database="my_first_db")

db_cursor =db_connection.cursor() #Here we modify existing column id db_cursor.execute


("ALTER TABLE student MODIFY id INT PRIMARY KEY")

OUTPUT: Here below see the id column is modified.


Let's perform insertion operation in MySQL Database table which we already create. We will
insert data oi STUDENT table and EMPLOYEE table.

SYNTAX:

INSERT INTO student (id, name) VALUES (01, "John")

INSERT INTO employee (id, name, salary) VALUES (01, "John", 10000)

Example:

Import MySQL. Connector

db_connection = mysql.connector.connect ( Host="localhost",User="root",Passwd="root",


Database="my_first_db")db_cursor = db_connection.cursor ()student_sql_QUERY =
"INSERT INTO student (id,name) VALUES(01, 'John')" employee_sql_QUERY = "
INSERT INTO employee (id, name, salary) VALUES (01, 'John', 10000)"

#execute cursor and pass QUERY as well as student data db_cursor.execute


(student_sql_QUERY)

#execute cursor and pass QUERY of employee and data of employee


db_cursor.execute(employee_sql_QUERY) db_connection.commit ()

print (db_cursor.rowcount, "Record Inserted")

OUTPUT:

2 Records Inserted
1. Click the Data in Excel

1. In the From ODBC dialog, choose your data source name (DSN). If you haven't
configured your ODBC driver yet, you can enter an SQL statement that will be executed
right after establishing a connection to the data source. Click OK.
1. select Database and enter your credentials in the dialox bog, then click Connect.

Select Default or Custom and press Connect.

4.Click Load.
OUTPUT:
PROCEDURE:

Open ODBC Data Sources (32-bit) and/or ODBC Data Sources (64-bit)

Setup the detail here, and then you can just pick it off the list later.
Step1: In a word document, click on the select recipients and in the drop down menu click on

the use an existing list

Step 2: Next in the select data source, click on the New source.

Step 3: Then in the data connection wizard, click on the other/advanced and then click next
Step 5:Then click the Maria DB ODBC 3.0 driver in the create new data source

Step 6: In the Data link properties, click the connection and select
the Use connection string in it and click build.
Steps 7: Next, click on the file data source in the select data source

Step 8: Then in the create new data source click on the MYSQL

ODBC 5.3 Unicode driver and click next

Step 9: Now type the file data source name that you want and then click browse and click

next.
Step 11: Then in the MYSQL connector/ODBC give the user id, password and the database

then click ok.

Step 12: Then in the select data source give the DSN name that you have given for the file
data source name
Step 13: Then in the data link properties give the user name, password and then tick the
check box allow saving password and click the test connection

Step 14: Next, in the data connection wizard click the table that you gave and click next

Step 15: Then click Finish

OUTPUT:

You might also like