Share


  • Select a row from a specific column by giving a condition-
    SELECT name, address FROM customers WHERE id=54
  • Select all the row accept a specific row from a column-
    SELECT name, address FROM customers WHERE id !=54
  • Select rows by implementing different condition-
    SELECT name, address FROM customers WHERE id <54
  • Select  rows between two specific rows by using statement BETWEEN-
    SELECT name, state FROM customers WHERE id BETWEEN 20 AND 30
      

  • For multiple conditions the use of statement AND-
    SELECT name, state, city FROM customers WHERE state='CA' AND city='Hollywood'
  • For multiple conditions the use of statement OR-
    SELECT name, state, city FROM customers WHERE state='CA' OR city='Hollywood'
  • Use statement AND, OR in the same query-
    SELECT name, state, city FROM customers WHERE id=2 OR id=5 AND state='CA'
  • Make query true for all conditions in the same order-
    SELECT name, state, city FROM customers WHERE (id=2 OR id=5) AND state='CA'


  • This is some kinds of sorting. If want to find out some portion of your information according to a order then follow the examples-
    SELECT name, cost FROM items WHERE cost>(250) ORDER BY cost DESC
    ELECT name, cost FROM items WHERE cost>( SELECT cost, AVG(cost) FROM items ) ORDER BY cost DESC



  • If you want want to create a custom column which will hold the upper case letters and everything then use the character function UPPER -
    SELECT name, UPPER(name) FROM customers
  • There are different kinds of function in MySQL like UPPER, one of them is SQRT which is numeric function -
    SELECT cost, SQRT(cost) FROM items
  • Use AVG function to find out average of your data -
    SELECT cost, AVG(cost) FROM items
  • Use SUM function to sum your data -
    SELECT SUM(bids) FROM items



  • Creating a custom column use the keyword CONCAT -
    SELECT CONCAT(city,',',state) FROM customers
  • Give name to the new custom column -
    SELECT CONCAT(city,',',state) AS new_info FROM customers



  • If you want to find a specific information from different sources/places from database then you can use the statement IN like this-
    SELECT name, state FROM customers WHERE state IN('CA','NY','NC')
  • If you want to find a specific information form different sources accept a few sources the then use statement NOT IN like this-
    SELECT name, state FROM customers WHERE state NOT IN('CA','NY','NC')
  • For the same conditions as mentioned above if you want to order your result according to a specific manner then use ORDER BY statement like this-
    SELECT name, state FROM customers WHERE state IN('CA','NY','NC') ORDER BY state




Contact Form
A good blog should have a Contact Us option in it so that readers can contact with the owner of the blog. This option helps to tighten the relationship between the blog and its reader. If you are blogging in Blogger then you might face a challenge to add a nice looking Contact Us form in blog. Blogger has a Contact widget but that doesn't look better, and you can't customize that. So, I am going to show you how to create a Contact Us form in Blogger with customizing option by the help of Google Form. From my point of view Google form is safe and secure. You can also use other 3rd party form in your blog. I have shown here how to create Google form. Just follow my steps and you will be able to create a Contact Us form.
Add HTML Meta Tag in Blogger
Meta tags are very important for any blog or website. Google bots read Meta tags and send information to Google search engine to show your website in Search Engine's result page. Follow the steps below to add Meta tags in your blog-
  • 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 name
    SELECT 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

Learn MySQL
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-
Add Facebook Popup Like Box Widget to Blogger
It is always a very good practice to link Facebook page to your blog. If you have a Facebook page which talks as similar as your blog does then you may want to let your blog readers know that you have a Facebook page regarding the topic of this blog by adding Facebook Popup Like Box Widget. It will not only help you to raise the followers of your Facebook page but it also will help you to convey your message to the vast number of people. I have shown you here how to add this Facebook like widget, just follow my steps and you will be successful to add this widget in your blog.
Sample code box

Steps to add code box in blogger:

  • Go to the Dashboard of your blog and select Template.
  •  Click on Customize.
    Customize
  • From the new window select Advanced and click on Add CSS.
  • Copy-Paste the below codes in the CSS empty box and apply to the blog.