How to use the update command in MySQL

Update command-  

  • To update the department & mobile no of suneel

Query-
update employee set Department= ‘IT’, salary= ‘15000’ where Emp_ID= 5775

Update Table

update user_leave_balance set cl_balance= ’20’ where Emp_id=’005969′; 

Advertisements

How to use ORDER BY query in MySQL

ORDER BY Query:

  • used to sort the result-set by one or more columns
  • ORDER BY keyword sorts the records in ascending order by
  • To sort the records in a descending order, you can use the
  • By default, it’s ascending order

Query –

select Salary from employee order by Salary Order By

 

 

 

select Emp_ID,FirstName,LastName,Department,Mobile_No,Salary,Address from employee order by Salary

Order By Data

How to insert data into table in MySQL

Insert data into table- 

Query-
insert into employee
( Emp_ID,FirstName,LastName,Department,Mobile_No,Salary,Address)
values(5776,’Zahid’,’Iqbal’,’Computer’,12345,11000,’Chandigarh’)

Insert Data into the tableImport the data from excel 

  • Data should be arrange in the table format and save the .csv format
  • Now select the import and choose the file
  • Now data are inserted into the table.

Import tha data from excel

After inserting the data table is-

Final table

MySQL Data Types

MySQL-data-types

MySQL supports a number of data types in several categories:
1. String (character and byte) types, and spatial types.
2. Date and time types
3. Numeric types

1. STRING DATA TYPES-
The following are the String Datatypes in MySQL:

String Data Types

2. NUMERIC DATATYPES-

The following are the Numeric Datatypes in MySQL:

Numeric Data Types

3. DATE/TIME DATATYPES-

The following are the Date/Time Datatypes in MySQL:

Date-Time