My sql

Isha Bharti
3 min readNov 20, 2020

structure query language.

  1. How to see current database where we are working=select database();
  2. How many data types in mysql=numeric type,string type,date time.
  3. IN numeric there is int,float =int we are using for whole number float for decimal number.
  4. In string there is varchar=we can write alphabet and we must have to decide length and the length is start from(1–255)
  5. IN date there is date= there is format y-m-d
  6. DDl (Data defination language)=are used to define or redfine schema object.
  7. DMl (DATA MANIPULATION LANGUAGE)=are usedd to manipulate data.
  8. Tcl(TRANSICTION CONTROL LANGUAGE =to manage transiction;
  9. The where clause is used to select specific rows.
  10. Between operator=making range
  11. in operator= selecting values form a list of values.
  12. like operator=making character comparison using strings.
  13. Alter table=can add exciting column and be redefined. for deleting (alter table table name drop column column name)for adding(alter table tablename add columnname datatypes.
  14. drop=for delete
  15. Primary key= it is a constraint its must contain unique values and cannot contain null.create table tablename(
    -> name varchar(250),
    -> id int not null,
    -> primary key (name) )Foreign key=we are using for link two tables together
  16. show table=for checking or watching table
  17. insert =insert into tablename values(column 1 datatypes);
  18. table data show =select * from tablename;
  19. warnings=show warnings;(if datatype we will write another data type)
  20. Null=the value is unknown ,its doesnt mean zero.
  21. not null=it mean we have to give value.if we will not give galue it will automatic come int num.
  22. default value in table=if we will not five any value then it will come default value. create table stu_form(stude_name varchar(250) not null default “isha”,
    -> stu_age int not null default 18);insert into stu_form values(); it will give default value.
  23. auto_increment =Its taking auto,atic number create table table_name(
    -> id int not null auto_increment,
    -> name varchar (55),age int,
    -> primary key(id) );
  24. where=select * from table name where age 20; if i want age name who is 20.select coloumn name from table .if i want row name
  25. Distinct statement=IT will remove dupluicate. if two name will there and the both name will same then it will give only one number.(select distinct column name from table_name.
  26. order by =we are using for ascending and descending order.
  27. Like operator=select column name from table name where name like “%a”; it will print if any name and in last there is a ,”a%” it will print if there is starting in A.
  28. comparison operator =Its compare two number
  29. (=) equal operator we are using (select * from table name where columnname =20; herer if any row_value is 20 then it will print. (select * count rowname from table name where columnname =20) it will give how many people who have 20 age.
  30. sum=it will add
  31. min = it will give minimum number
  32. Not equal operator=(!=)(<>).
  33. Logical operator = And (&&)(the both conditon will true then it will print True ) select * from tablenamea where roename=”isha” and rowname=31; )if the both will true then it will print other wise it will come empty set.(or) if the one condition will true then also it will print.
  34. Group by =it will give result by set where we are using avg sum count.
  35. Foregin key =it used to link two table
  36. join =we are joining two table
  • (INNER) JOIN: Returns records that have matching values in both tables
  • LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table
  • RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table
  • FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table.

38. how to join two table=

create table customer(cid int not null auto_increment primary key,cname varchar(255) ); think

39. show databases =for checking database;

40. show database table name = for chekin table data.

LEARN MORE KEEP MORE BE CALM AND LEARNING WELLL.

GOD BLESS YOU.

--

--