HTML Boolean Attributes

The presence of boolean attribute on html element represents it true and absence of boolean attribute on any html element represents it false.

If the attribute is present in any html element, its value must be empty or the name of the attribute in value of attribute like below:

Possible Correct Syntax:


  1. <tag_name attribute_name="attribute_name"></tag_name>
  2. <tag_name attribute_name="attribute_name" />
  3. <tag_name attribute_name=""></tag_name>
  4. <tag_name attribute_name="" />
  5. <tag_name attribute_name></tag_name>
  6. <tag_name attribute_name />


Possible Wrong Syntax:

  1. <tag_name attribute_name="true"></tag_name>
  2. <tag_name attribute_name="false"></tag_name>
  3. <tag_name attribute_name="true" />
  4. <tag_name attribute_name="false" />


The values “true” and “false” are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.

Here are the some of boolean attribute of HTML elment.

  • seamless
  • checked
  • hidden
  • disabled
  • required

Difference between “WHERE” and ”HAVING” clause

where clause can not accept aggregate function like sum, count, etc. whereas having clause can accept the aggregate functions like sum, count, average, etc.

Let’s see it by example.

paid_id emp_id  salary_given salary_month
1 1 1000 jan
2 2 1500 jan
3 3 2000 jan
4 1 1200 feb
5 2 1500 feb
6 3 1800 feb


emp_id emp_name
1 Sajid
2 John
3 Ahmad



  1. SELECT emp_detail.emp_name, emp_salary_paid.salary_month, emp_salary_paid.salary_given
  2. FROM emp_detail, emp_salary_paid
  3. WHERE emp_detail.emp_id=emp_salary_paid.emp_id


will produce result like this one. because no aggregate function is being used here.

emp_name salary_month salary_given
Sajid jan 1000
Sajid feb 1200
John jan 1500
John feb 1500
Ahmad jan 2000
Ahmad feb 1800
  1. SELECT emp_detail.emp_name, SUM(emp_salary_paid.salary_given) AS total_paid
  2. FROM emp_detail, emp_salary_paid
  3. GROUP BY emp_detail.emp_id
  4. WHERE SUM(emp_salary_paid.salary_given) >2000

This will produce an error, because aggregate function is being used with where clause. To overcome this, we use having clause like this one.

  1. SELECT emp_detail.emp_name, SUM(emp_salary_paid.salary_given)
  2. FROM emp_detail, emp_salary_paid
  3. GROUP BY emp_detail.emp_id
  4. HAVING SUM(emp_salary_paid.salary_given) > 2000

This will produce the correct result as follows:

emp_name total_paid
Sajid 9000
John 9000
Ahmad 9000