Hartron Syllabus Important Question Part 10
Q. 10 a) What is CSS? Explain its Type?
Ans:-
Cascading Style Sheets is a presentation definition language that is used to control the layout of HTML document by attaching styles. With cssyou can apply styles such as color of text set margins of fonts, background, images, spacing between paragraph and words and much more.
There are the following three types of CSS: (Hartron Syllabus Question)
- Inline CSS.
- Internal CSS.
- External CSS
1. Inline Style Sheet-
Inline Style Sheet are those which are included within a single specific live occurrence of an element in HTML document. In other words, they are placed inline within the element. Its effect is limited to the element in which it is specified. To use inline style, use the STYLE attributes in the opening tag of the relevant element. The value that is assigned to the style attribute is a declaration(s) enclosed in double quotes. Each declaration must be in the form of
Property: value pair and must be separated by a semicolon. The syntax for specifying inline style sheets is
<!DOCTYPE html> <html xmlns=”http://www.w3. org/1999/xhtml”> <head> <title> Demo css</title> </head> <body> <h3> style=”font-family:arial; background-color:green;” this is a test css </h3> </body> </html>
2. Embedded, style sheet-
The inline style sheet is very useful if you want to apply styles to all the specific occurrences of a specific element within the entire webpage then you will have to specify style for all occurrence of the element which is a very time consuming process. So to solve this problem, the embedded style sheets are used. (Hartron Syllabus Question)
An Embedded style sheet is used when you want to apply styles to the elements within a single webpage. They are defined in the element by using the
<!DOCTYPE html> <html xmlns=”http://www.w3. org/1999/xhtml”> <head> <title>Demo css</title> <style>body {font-family: ‘Buxton Sketch’; color:red; background-color:yellow;}p {color:blue; }
</style> </head> <body> <h3> this is a test css </h3> </body> </html>
3 .External style sheet-
An External style sheet is a template or file consists only of CSS rules and comments but does not contain any markups. An external style sheet must have an extension .css. These files are stored separately from the web pages of the website to which they are applied.
In order to apply these rules, you need to just link this file to each web page on the website to which rules need to be applied. This is done element in the section of the web page. The element generally takes up the form,
<!DOCTYPE html> <html xmlns=”http://www.w3. org/1999/xhtml”> <head> <title>Demo css</title> <link href=”mystyle.css” rel=”stylesheet” /> </head> <body> <h3> this is a exaternal css </h3> </body> </html>
Q. 10 b) What are join in sql? Explain its type with example?
Ans:-
A JOIN clause is used to combine rows from two or more tables, based on a related column between them.
Different Types of SQL joins:
Here are the different types of the joins in SQL:
- (INNER) JOIN: Returns records that have matching values in both tables
- LEFT (OUTER) JOIN: Return all records from the left table, and the matched records from the right table
- RIGHT (OUTER) JOIN: Return all records from the right table, and the matched records from the left table
- FULL (OUTER) JOIN: Return all records when there is a match in either left or right table
1) SQL INNER JOIN Keyword:
The INNER JOIN keyword selects records that have matching values in both tables.
INNER JOIN Syntax:
SELECT column_name(s)FROM table/INNER JOIN table2 ON table1.column_name = tabl e2.column_name,
Example: SELECT Orders.orderid, Customers.customername
FROM Orders
INNER JOIN Customers ON Orders.customerid = Customers.customerid;
2) SQL LEFT JOIN Keyword:
The LEFT JOIN keyword returns all records from the left table (table1), and the matched records from the right table (table2). The result is NULL from the right side, if there is no match.
LEFT JOIN Syntax:
SELECT column_name(s)FROM table1LEFT JOIN table2 ON table1.column_name = table2.column_name;
Example:
SELECT Customers.customername,Orders.orderidFROM Customers
LEFT JOIN Orders ON Customers.customerid = Orders.customerid;
3)SQL RIGHT JOIN Keyword:
The RIGHT JOIN keyword returns all records from the right table (table2), and the matched records from the left table (table 1). The result is NULL from the left side, when there is no match.
RIGHT JOIN Syntax:
SELECT column_name(s)FROM table1
RIGHT JOIN table2 ON table1.column_name = table2.column_name;
Example:
SELECT Orders.orderid, Employees. lastname, Employees.firstname FROM OrdersRIGHT JOIN Employees ON Orders. employeeid = Employees.employeeid;
4)FULL OUTER JOIN Keyword:
The FULL OUTER JOIN keyword return all records when there is a match in either left (table1) or right (table2) table records.
FULL OUTER JOIN Syntax:
SELECT column_name(s)FROM table1
FULL OUTER JOIN table2 ON table1.column_name =table2.column_name;
Example:
SELECT Customers.customername,
Orders.orderid FROM customersfull OUTER JOIN Orders ON Customers.customerid-Orders.customerid;