My SQL
My SQL
The full form of MYSQL is My Structured Query Language. It is a popular open-source relational database
management system (RDBMS) that is used for storing and managing data.
It allows users to create, modify, and query a database, as well as manage the security and access controls for that
database.
Queries :
To create table and its structure into database : create table table_name(column_name datatype , column_name
datatype (size));
To set column key and more properties : Create table table_name ( Column_name datatype not null
auto_increment primary key );
To Changing properties of existing column : alter table table_name modify column column_name datatype not null
auto_increment primary key ;
**It will be alter column only if column fulfil all confition according to its oroperties . i.e if column have any of null record or duplicate data it will
shows u error .
To insert data into table : insert into students value ( data 1 , data 2 )
To see specific column if condition if fulfill : select * from table_name where condition;
To see multiple colmn while condition fulfill : select column1, column2, ... from table_name where condition;
To see multiple column while all given conditions fulfil : select column1, column2, ... from table_name where
condition1 and condition2 and condition3 ...;
To see multiple column while any of given conditions fulfil : select column1, column2, ... from table_name where
condition1 or condition2 or condition3 ...;
To see multiple column while conditions not fulfil : Select column1, column2, ... from table_name where not
condition;
To see multiple column in ascending / decending order : select column1, column2, ... from table_name order by
column1, column2, ... asc|desc ;
To update column datas : update table_name set column1 = value1, column2 = value2, ... where condition;
To rename column name : alter table table_name rename column old_name to new_name;
To change column properties : alter table table_name modify column column_name datatype;
To delete row of table while condition fulfil : delete from table_name where condition;
To see min data of a column : select min(column_name) from table_name where condition;
To see no.of data in a column : select count(column_name) from table_name where condition;
To see sum of data of a column : select sum(column_name) from table_name where condition;
To see avg of data of a column :select avg(column_name) from table_name where condition;
select column1, columnA, column2 from table_name1 left join table_name2 on table_name1.column_name
= table_name2.column_name ;
To search data by characters or numbers or symbols : select column1, column2, ... from table_name where columnN
like 'a%';
Wildcarts :