day1:
lets learn mysql queries to create table and database;
lets take one table sample from that we will write queries later we will learn to create the table and data base
photo from w3school |
SELECT SYNATX: SELECT column1,column2.... FROM tablename
here for us we use * to select all columns and table name is Customer.
SELECT * FROM Customer;
it will display all the details
To display a particular row we can retrieve using customerID as it is a primary key.
Example:
SELECT * FROM Customer where CustomerID=2;
2 Ana Trujillo Emparedados y helados Ana Trujillo Avda. de la Constitución 2222 México D.F. 05021 MexicoTO select ANY COLUMN from customers then we can use any column name.
example: SELECT City FROM Customers;
it will display all the cities.
To display different values of a particular column we can use keyword "DISTINCT"
example: SELECT DISTINCT Country FROM Customers;
only countries that are different wil be displayed. if any country is repeated many times it will be displayed only once.
WHERE clause: it used to filter the records more to get more specific data
Syntax: SELECT col1,col2,col3 FROM table_name WHERE= condition;
No comments:
Post a Comment