- If you want to run multiple queries at a time then command for selecting city and id from customers-SELECT city FROM customers;
SELECT id FROM customers; - You run the any query by giving line breaks and white spaces, it wont affect the command/result-SHOW COLUMNS
FROM customers
- If there is duplicate result in data but you are asked to show distinct result then command-SELECT DISTINCT state FROM customers
- If you are asked to find a list of 10 customers from selected tables and columns then command-SELECT id, name FROM customers LIMIT 10
- Use LIMIT to select the id and name columns from customers showing 10 results, starting from the fifth-SELECT id, name FROM customers LIMIT 5,10
- If you have more tables in your database those who are holding columns of same name then you can sort out the specified column and its data form a table by this command-SELECT customers.address FROM customers
- If you want sort your result in alphabetic order or numeric order then command-SELECT name FROM customers ORDER BY nameSELECT name, address FROM customers ORDER BY id
- If you want to sort multiple columns then the command should be like this-SELECT name, state, address FROM customers ORDER BY state, name
- Retrieve more than one column of a table in the same SELECT statement-SELECT name,zip FROM customers
- Show all the columns of a table in the same SELECT statement-SELECT * FROM customers
- To see your databases command-SHOW DATABASES
- To see your tables in a database command-SHOW TABLES
- To see all the column names in a table named customer command-SHOW COLUMNS FROM customers
- If you want to select a column named city from the table customer then command-SELECT city FROM customers
I am going to make a few tutorials about MySQL to let you know how to create it and access it. Before going to make that I want to let you know something which is important about SQL and MySQL. MySQL is the world's most popular open source database. Here you can ask-What is database? A database is a collection of data made up of tables to store similar information. It is very much organized to handle data in it. For example we can say about YouTube. YouTube doesn't hold data in a single table in database. You Tube holds data of its users, videos and comments by creating several tables. These tables are made up of columns and rows. Here columns are like categories, and rows are like each separate entry ie, each entry goes on a separate row. In this way database works. In a nutshell, we can say that database is a collection of organized data. As I am going to make some tutorials about SQL, I want to tell you some basics about SQL and MySQL. These are-

