SQL and Django important question
SQL and Django important question for class 12
Q1.what is “data type”? what main objectives.
ans. data type is defined as a set of values along with the operations that can be performed on those values.
some data types are integer, float, varchar, char, string, etc.
main data types are:-
-optimum usage of storage space.
-represent all possible values.
-improve data integrity.
Q2. (a) write two examples of DBMS software.
(b)what is meant by NULL value in MYSQL.
(c)table ‘club’ has 4 rows and 3 columns. Table ‘member’ has 2
rows and 5 columns. What will be the cardinality of the Cartesian product of them.
ans.(a) (i)oracle (ii)SQL server (iii)MYSQL
ans. (b) null value signifies a legal empty value.
ans. (c) 8
Q3. the SQL SELECT provides clauses for sorting data and for summarizing results. Write the names of clauses for these.
ans. the order by clause of SQl SELECT statement allows to sort the data of result set. the GROUP BY clause of SQL SELECT statement allows to create summarized results of grouped data from table.
Q4.what are different types of SQL functions.
(i) single row (or scalar) function
(ii) multiple row (or group or aggregate) functions.
(i)single row functions work with a single row at a time. A single row function returns a result for every row of queried table.
(ii)multiple row or group function work with data of multiple rows at a time and return aggregated value.
SQL and Django
Q5.write a query to display the sum, average, highest and lowest salary of the employees grouped by department number.
ans. select sum(sal),avg(sal),max(sal),min(sal)
grouped by deptno, job
Q6.write a query to display the number of employees with same job.
ans. select coun(*) “no_of_emps”,job
group by job
Q7.write a query that counts the number of salespeople registering order for each day.(if a salesperson has more than one order on a given day, he or she should be counted only once)
ans. select ord_date,count(distinct salesman_code) from orders
group by ord_date
Q8.A_______is a property of the entire relation, which ensure through its value that each tuple is a unique in a relation.
(a)rows (b)key (c)attribute (d)fields
Q9.consider following SQl statement. What type of statement is this.
create table employee (name varchar, id integer)
(a)DML (b) DDL (C)DCL (D)integrity constraint
ans. (b) DDL
Q10.consider following SQL statement. What type of statement is this.
insert into instructor values(10211,’shreya’,’biology’,66000)
(a)procedure (b)DML (c)DCL (D)DDL
ans. (b) DML
Q11. in the given query which keyword has to be inserted.
insert into employee______(1002,kausar,2000)
(a)table (b)values (c)relation (d)field
Q12. what is the difference between where and having clause.
ans. the having clause places condition on groups in contrast to where clause, which places conditions on individual rows.
Q13.what is web framework.
ans. a web framework is a software tool that provides a way to build and run dynamic websites and web-enabled applications.
Q14.write Django command to create a Django project namely easy sell.
ans. Django-admin startproject easysell.
(ii) 35 12
(iii) invalid query
(i) select * from customer
(ii) select * from item
where price between 35000 and 55000
(iii) select customerName,city,itemName,price
(iv) update item
for important question of society law and ethics:- click here