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

1 - // How To Connect Mysql Server To Command Prompt

1. The document discusses how to connect to a MySQL server using command prompt and perform various SQL queries and functions. 2. It includes examples of creating tables, inserting data, updating records, joining tables, and using aggregate, string and mathematical functions. 3. The key topics covered are connecting to MySQL, creating and populating tables, modifying data, retrieving data through queries, performing joins and aggregations, and establishing relationships between tables.

Uploaded by

TNT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

1 - // How To Connect Mysql Server To Command Prompt

1. The document discusses how to connect to a MySQL server using command prompt and perform various SQL queries and functions. 2. It includes examples of creating tables, inserting data, updating records, joining tables, and using aggregate, string and mathematical functions. 3. The key topics covered are connecting to MySQL, creating and populating tables, modifying data, retrieving data through queries, performing joins and aggregations, and establishing relationships between tables.

Uploaded by

TNT
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

1 --//* How to Connect MySql server to Command

prompt *//

2--/* Write Command to access MySql server using


Command Prompt. *//
Q1 :- Show Existing Databases.
Q2 :- Create New Databases.
Q3 :- Show the Newly created Databases.
Q4 :- Use Databases.
3--create a student table:
>>student(roll_no int,name char(20),DOB date,marks int) .
>>ENTER 5 tuples/rows in the table.

>>REMOVE attribute marks from the table.


>>CHANGE datatype of roll_no from into char.
>>ADD new attribute phone
4--Q1 :- Create A Book Table With Attributes : "Book_Id , Title , publication ,
author , YOP , Price"
4--Q2 :- Enter 5 tuples in a tables

4--Q3 :- Display the Content of the tables.


4--Q5 :- Display the different publication from the list.
4--Q6 :- List the Book from low to high price range.

5--Execute following
(I) NUMBER FUNCTION
(II) AGGREGATE FUNCTIONS
(III) character functions
# Function Description
I INITCAP(data) Converts the first letter of string data to uppercase
II LENGTH(data) Returns the length of string data
III SUBSTR(data, x, y) Extract y characters starting from x
IV INSTR(data, x) Returns location of x in string data
V INSTR(data, x, s, n) Returns location of the nth occurrence of string x in
string data starting from s
VI GREATEST(expr1, …, exprn) Returns the greatest value from the given set
of values
VII LEAST(expr1, …, exprn) Returns the least value from the given set of
values

6-create a empsalary table:


empsalary(emp_id int,ename varchar(30),department char(30),dob
date,salary real).
>>CREATE above table.

>>ENTER six tuples into the table.


>>DISPLAY the values.
>>find the SUM of the salary of all employees.
>>find the AVERAGE of the salaries.
>>find the SUM and AVERAGE of the salaries.
>>find the LEAST salary.
>>find the HIGHEST salary.

6-create a empsalary table:


empsalary(emp_id int,ename varchar(30),department char(30),dob
date,salary real).
>>CREATE above table.

>>ENTER six tuples into the table. >>DISPLAY the values.


>>find the SUM of the salary of all employees.

>>find the SUM and AVERAGE of the salaries.

>>find the LEAST salary.

>>find the HIGHEST salary.


7-//PERFORM THE FOLLOWING QUERIES ON "STUDENT" TABLE.//
>>SELECT no. of the student whose enroll='3'.

>>SHOW the values of attribute NAME from the student table.


>>Upadting table row.

(a)update the name attribute with WHERE clause.


(b)update the name attribute without using 'WHERE' clause.

>>DELETING table rows.


8--RETRIEVING DATA
use student table for the following queries.
>>Retrieving specific column.

>>printing with the user defined heading .


>>Using logical operator (AND ,OR, NOT).

>>using IN function.
>>using LIKE operator.
(a) PERCENTAGE(%)

(b)UNDERSCORE(_)

9->>Create table student(id int,name char(11).


>>Enter 4 tuples to student table.
>>student_info(id int,course char(11)).
>>Enter 4 tuples to student_info table.
perform the following operation:-
>>cross join.
>>inner join.
10- Create table dept(dept_no as a primary key,d_name) and emp(emp_id as
a primary key,e_name,dept_no as a foreign key).
Enter minimum 5 tuples to each table and perform the following operation.
• Union

• Union of All

You might also like