Any row in a relation can be distinguished from other rows by using an attribute (there may be one or more). Such attributes are called Keys.
Data is vital to any organization and some of it may be confidential. Confidential data must not be accessed by any unauthorized person. A database management system has authentication schemes laid down, giving different levels of users different permissions to access data. According to this, user may be to allowed modify the data or simply read it without making any changes. The data that can be seen is also controlled.
Using the set intersection operation, we can find tuples that are common to two relations. It is represented by the ∩ sign. Consider the example below. The two tables are A and B. The operation A ∩ B gives another relation which is the result of this operation. It is the same as writing A – (A – B). The two relations must be compatible i.e. of the same degree and the domains of the corresponding columns must be the same.
A B
|
Class |
Name |
Age |
|
II |
ASHISH |
7 |
|
III |
PUNIT |
8 |
|
III |
RAJAT |
8 |
|
Class |
Name |
Age |
|
II |
ASHISH |
7 |
|
III |
RAJAT |
8 |
The result of A ∩ B is
|
Class |
Name |
Age |
|
II |
ASHISH |
7 |
|
III |
RAJAT |
8 |
Using the set difference operation, we can find tuples that exist in one relation but in the other. It is represented by the – (minus) sign. Consider the example below. The two tables are A and B. The operation A – B gives another relation which is the result of this operation. The two relations must be compatible i.e. of the same degree and the domains of the corresponding columns must be the same.
A B
|
Class |
Name |
Age |
|
II |
ASHISH |
7 |
|
III |
PUNIT |
8 |
|
III |
RAJAT |
8 |
|
Class |
Name |
Age |
|
II |
ASHISH |
7 |
|
III |
RAJAT |
8 |
The result of A - B is
|
Class |
Name |
Age |
|
III |
PUNIT |
8 |
There are three levels of data abstraction :
1. Internal Level (Physical Level) - This level describes how the data is actually stored on the storage medium.
2. Conceptual Level - This level describes what data are actually stored in the database.
3. External Level (View Level) - This level is concerned with the way the data is viewed by individual users.
With the complex tasks to be performed by database systems, certain things may crop up as the disadvantages. These are -
1. Security may be compromised without good controls.
2. Integrity may be compromised without good controls.
3. Extra hardware may be required.
4. Performance overhead may be significant.
5. System is likely to be complex.
The union operation requires two relations and produces another relation that contains tuples from both the relations. For this operation, both relations must be union compatible. That means, for a union operation AUB to be valid, the following two conditions must be satisfied by the two operands A and B :-
1. The relation A and B must be of the same degree.
2. The domains of the ith attributes of A and the ith attribute of B must be the same.
The Project operation selects attributes(columns) from a relation. It is denoted by the Greek letter pi i.e. Π. The result is a vertical subset of the given relation. Any duplicate rows are automatically removed. The columns appear as subscript to Π and the table name appears in parenthesis.
If we write,
Relation – A table with rows and columns to store data.
Entity – It is something that exists, for which data is stored. For example a person, place, department etc.
Domain – It is the set of permitted entries in a column. For example, a column COLOUR, may have the domain {red, green,blue} where these are the only permitted values.
Degree – It is the number of columns(or attributes) in a table.
In a file processing system, data is stored in various files. In order to access or modify the data in these files, programs have to be written. Some problems that commonly arise in such systems are data redundancy, data inconsistency, loss of data integrity, incorrect data, insecure data and data that is not according to set standards.
The database management system is inherently for sharing of data and provides controls so that the problems encountered in the earlier mentioned system, i.e. File Management System, are eliminated or minimized.
Select operation selects tuples(rows) that satisfy a certain condition(or predicate), from a relation. It gives a horizontal subset from the relation where each row satisfies the given condition. The select operation is denoted by the small Greek letter sigma.
If we write,
Sales>2000(SALESMEN) the result will be those rows from relation SALESMEN where Sales is more than 2000.
Candidate Key - A candidate key is the one that is capable of becoming primary key i.e., a field or attribute that has unique value for each row in the relation.
Cardinality of a relation - It represents number of rows in the relation.
A. SELECT.
B. GET.
C. OPEN.
D. READ.
SELECT command is used to select or extract data from database table.
A. *
B. /
C. –
D. @
- is used as a continuation character in SQL* plus.
A. SUBSTR.
B. SUBSTRING.
C. INSTR.
D. STRING.
The function which returns substring of a string is SUBSTR. .
A. allow only null values.
B. not allow unique values.
C. display data stored by default.
D. provide a previously specified value.
The DEFAULT constraint is used to insert a default value into a column. The default value will be added to all new records, if no other value is specified.
A. stores numeric value.
B. stores character value.
C. stores NULL.
D. stores address.
Pointer is a variable which is used to store address of another variable.This memory address is the location of another variable.
A. SELECT date FROM dual;
B. SELECT date( );
C. SELECT sysdate FROM dual;
D. SELECT system_date;
SELECT is used to display the date from table Dual. Oracle provides a dummy table called Dual which has just one row and one column.
A. compare values in a condition.
B. combine the results of two conditions.
C. carry out arithmetic operations.
D. can carry out pattern matching.
Relational operators compare two operands and determine the validity of a relationship.
A. not allow duplicate values in a column.
B. allow only one column in the table.
C. apply only to primary key column.
D. allow only unique rows in a table.
It represents restriction on a set of columns in which all values must be unique. This constraint ensures that no two rows have same value in the specified column.
A. number.
B. char.
C. date.
D. text.
Date is always stored in 'date' data type.
A. number.
B. char.
C. date.
D. text.
Age is always stored in number form. For e.g., 10,12,21,32 etc.
A. has only one column.
B. does not have primary key.
C. is empty.
D. does not have null values.
The DELETE statement allows you to delete a single record or multiple records from a table. The syntax for the DELETE statement is: DELETE FROM table WHERE predicates;
A. a table that stores data from another table.
B. not defined in the data dictionary.
C. like a window to view data of a table.
D. created from only one table.
In database theory, a view consists of a stored query accessible as a virtual table composed of the result set of a query.
A. display an error message.
B. match all strings beginning with ‘abcd’.
C. match all strings beginning with "ab%cd".
D. match all strings beginning with ‘ab%cd’.
In order for patterns to include the special pattern characters (that is, %, _), SQL allows the specific of an escape character. The escape character is used immediately before a special pattern character to indicate that the special pattern character is to be treated as a normal character. To define the escape character for a LIKE comparison,we use the ESCAPE keyword.
A. display an error message.
B. match all strings beginning with H and end with _.
C. match all strings beginning with H and ending with e.
D. will not include the _ in the output.
The SQL statement will return all names that start with H and end in _. For example, it would return a value such as 'Hello_'.
A. SELECT * FROM EMP WHERE name LIKE ‘%an’ ;
B. SELECT * FROM EMP WHERE name = ‘%an’ ;
C. SELECT * FROM EMP WHERE name = ‘%an’ ;
D. SELECT ALL FROM EMP WHERE name like ‘%an’ ;
The LIKE keyword is used to select rows containing columns that match a wildcard pattern.
A. SELECT * FROM EMP WHERE name like ‘An____’ ;
B. SELECT * FROM EMP WHERE name like ‘An%’ ;
C. SELECT * FROM EMP WHERE name = ‘An%’ ;
D. SELECT ALL FROM EMP WHERE name like ‘%An%’ ;
The LIKE keyword is used to select rows containing columns that match a wildcard pattern.
A. data can be updated easily.
B. constraints can be discarded.
C. data can be displayed selectively.
D. data can be viewed in sequence.
A view provides
1. Simplicity - you can see exactly what you need.
2. Security - it prevents unauthorised users from seeing unrelevant information.
A. SELECT count(DISTINCT author) from Books ;
B. SELECT count(DISTINCT name) from Books ;
C. SELECT DISTINCT count(author) from Books ;
D. SELECT count(author) from Books ;
The DISTINCT keyword ensures that multiple entires of the same author are ignored.
A. SELECT ALL FROM item ;
B. SELECT * FROM item ;
C. SELECT * ALL FROM item ;
D. SELECT FROM item ;
To see the entire table i.e., every column of a table, we need not give a complete list of columns. The asterisk(*) can be substituted for a complete list of columns.
A. it does not contain numeric data.
B. data in it is not ordered.
C. the primary key value is provided.
D. it is defined from a single relation.
A view is updatable if it has been defined from a single relation and the update query can be mapped on to the base table successfully.
A. CREATE TABLE Customer (First_Name, Last_Name, Address, City, Country char, Birth_Date );
B. CREATE TABLE Customer (First_Name char(25), Last_Name char(25), Address char(50), City char(25), Country char(25), Birth_Date date );
C. CREATE TABLE Customer (First_Name char(25) Last_Name char(25), Address char(50), City char(25), Country char(25),Birth_Date date (21) );
D. CREATE TABLE Customer (First_Name char(25) || is concatenation operator and only one column will be displayed as “ADDRESS” and the syntax of date is date. It cannot hold size of (21). It is yyyy-mm-dd. B. SELECT DISTINCT Marks from Student; C. SELECT Marks. Student; D. SELECT Student “ Marks ”; DISTINCT eliminates the duplicate rows from the result of SELECT statement. B. Create < tablename > < datatype > < size >,< column name > < datatype > C. CREATE TABLE < tablename > (< column name1 ,< datatype > [ < size > ] ),< column name 2 >, datatype > [ < size > ]..). D. CREATE < table-name > (< datatype > [(size)], < data type > When a table is created, its column names, data types and size are supplied for each column.
B. MODIFY Persons SET LastName='Hansen' INTO LastName=Nilsen. C. UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'. D. MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'. When we need to change some values in an existing row, we can use UPDATE command. It specifies the rows to be changed using the WHERE clause.
B. 10 JUL 00. C. 12 JUL 00. D. 17 JUL 00. NEXT_DAY returns the date of the next weekday specified in the 2nd argument. B. TCL. C. DML D. DDL and DML Data Definition Language (DDL) provides statements for creation and deletion of tables and indexes. B. TCL. C. DML. D. DNL. Data Manipulation Language (DML) provides statements to enter, update, delete data and perform complex queries on these tables. B. SELECT DISTINCT city FROM employee; C. SELECT ALL city FROM employee; D. SELECT DISTINCT city; DISTINCT keyword ensures that the multiple entries of the same city are ignored.
B. SELECT count (*) employee; C. SELECT * FROM employee; D. SELECT count FROM employee; COUNT is also an aggregate function used in SQL. B. SELECT order by(salary) FROM employee WHERE grade="A1"; C. SELECT sum (salary) FROM employee WHERE grade='A1'; D. SELECT sum (salary) FROM employee HAVING (grade) ="A1"; Sum is an aggregate function that is used to find the total value. Aggregate functions can be applied to all rows or to a subset of the table specified by a WHERE clause. B. modifies the column size only. C. deletes some columns in a table only. D. can either add columns, modify the sizes or delete columns in a table. ALTER table command is used to change the definitions of existing tables. It can modify, delete or change sizes of columns. B. DELETE ALL FROM employee; C. DELETE * FROM employee; D. DELETE employee; DELETE B. DELETE employee WHERE salary > 5000; C. DELETE FROM employee WHERE salary > 5000; D. DELETE employee having salary > 5000; Delete command is used to remove some or all of the rows in a table. B. view names as well as its base table will be deleted from data base. C. only base table will be deleted. D. either view name or base table will be deleted from database. When a view is dropped, only view is deleted. It does not cause any change in the base table and the base table remains intact. B. DELETE VIEW names. C. DROP VIEW employee. D. DROP VIEW. DROP command deletes a view from database. Its syntax is DROP VIEW (viewname). B. if it is has WHERE clause. C. if it has ORDER BY clause. D. only if it is an empty table. A table with rows in it cannot be dropped. First, we use a DELETE command to remove all the rows then we can drop the empty table so that it is no longer recognised in the database.
B. in an error. C. in showing the view table which had been created. D. in showing the base table which was dropped. As the table is dropped that means it has been deleted from the database, therefore, its dependent view will not generate any table and will give an error. B. the current system date. C. the previous day system date. D. the following day system date. This function returns the current system date of your computer. B. it will return i. C. it will return Adi. D. it will return iti iti iti. Substr (expn, start position, no of char) returns the given no. of chars (integer) from a character string expn starting at the specified startpos (integer). B. it will return **55. C. it will return *****. D. it will return 55. It repeats the given expression the specified number of times. B. DCL. C. DML. D. DGL. The DML provides statements to enter, update, delete data and perform complex queries on these tables. B. Data Convert Language. C. Dynamic Control Language. D. Dynamic Convert Language. Data control language (DCL) refers to the subgroup of SQL statements that controls access to database objects and data. These statements begin with one of the following keywords: GRANT, or REVOKE. B. not allow unique values. C. display data stored by default. D. provide a previously specified value. A default value can be sepcified for a column using the DEFAULT clause. When a user does not enter a value for the column (having default value), automatically the defined default value is inserted in the field. B. places conditions on groups. C. can be used in absence of GROUP BY clause. D. cannot be used with aggregate functions. The HAVING clause is used in combination with the GROUP BY clause. It can be used in a SELECT statement to filter the records that a GROUP BY returns.
B. DCL. C. DML. D. TCL. It is used to create a new table. DDL identifies the type of data division such as data item, segment, record and data-base file. B. char. C. date. D. text. NUMBER stores number data type both in fixed and floating points. NUMBER(p)means just digits, for example NUMBER(8)stores 8 digits. NUMBER(p,s) stores digits and decimals. For example, NUMBER(4,2) will store 4 digits and 2 decimals. B. gives the table name. C. selects rows that meet a condition. D. comes before the FROM clause. The WHERE clause in SELECT statement specifies the criteria for selection of rows to be returned. B. cannot be used with ORDER By clause. C. can output only one function in a query. D. do not take arguments. The HAVING clause is used in combination with the GROUP BY clause. It can be used in a SELECT statement to filter the records that a GROUP BY returns.
B. Data Manipulation Language. C. Dynamic Markup Language D. Dynamic Mapping Language. The DML (Data Manipulation Language) provides statements to enter, update, delete data and perform complex queries on these tables. B. Sequential Query Language. C. Simple Query Language. D. Structured Query Language. SQL is a language that enables you to create and operate on relational databases, which are sets of related information stored in tables. B. ALTER TABLE. C. INSERT. D. UPDATE. SELECT, UPDATE, INSERT are examples of DML Commands and ALTER TABLE is a DDL statement. B. DCL. C. DML. D. DGL. The DDL provides a set of definitions to specify the storage structure and access methods used by the database system. It provides statements for the creation and deletion of tables and indexes. B. char C. date D. text The CHAR data type must be enclosed in single quotes such as 'text', 'example' etc. Two adjacent single quotes (' ') inside the string will represent one single quote. B. SELECT name, price FROM item ; C. SELECT name, price FROM table item ; D. SELECT name, price FROM tablename item ; The SELECT command lets you make queries on the database. A query is a command that is given to produce certain specified information from the database table(s). The SELECT statement can be used to retrieve a subset of rows or columns from one or more tables.
B. CREATE, ALTER. C. UPDATE. D. GRANT, REVOKE. SELECT, DELETE, UPDATE are the examples of DML Commands. CREATE and ALTER are examples of DDL Commands and GRANT, REVOKE are DCL statements. B. cannot be used with ORDER BY clause. C. can output only one function in a query. D. do not take arguments. SQL aggregate functions return a single value, calculated from values in a column. B. SELECT * FROM tab1 ORDER BY marks ; C. SELECT * FROM tab1 GROUP BY ASCENDING; D. SELECT * FROM tab1 SET ORDER ASC ; ORDER By is the clause which is used to order the values or data in ascending or descending order. By default, it orders the data in ascending order.
B. SELECT * FROM tab1 ORDER BY marks ; C. SELECT * FROM tab1 ORDER BY ASCENDING; D. SELECT * FROM tab1 SET ORDER ASC ; The ORDER BY keyword is used to sort the result-set by a specified column.The ORDER BY keyword sorts the records in ascending order by default. B. gives the table name. C. selects rows that meet a condition. D. comes before the FROM clause. The WHERE clause is used to extract only those records that fulfill a specified criterion.
B. combine the results of two conditions. C. carry out arithmetic operations. D. can carry out pattern matching. Logical operators are typically used with Boolean(logical) values and return a Boolean value. B. Do not tell a lie. C. I am hungry, D. Are you going? Logical statement is one that can result into either true or false values. B. maxterms only. C. both minterms and maxterms. D. either minterms or maxterms. When a Boolean expression is represented purely as sum of minterms or product terms, it is said to be in canonical sum of products form. When a Boolean expression is represented purely as product of maxterms, it is said to be in canonical product of sum form of expressions. B. truth table. C. combinational table. D. binary table. Truth table is a table, which represents all the possible values of logical variables along with all the possible results of the given combinations of values. B. minmax. C. minterm. D. maxterm. A maxterm in n variables x1,x2,x3,………………, xn is defined as a sum (using OR operation) of n variables. B. maxterm. C. minmax. D. maxmin. A minterm in n variables x1,x2,x3,……………., xn is defined as a product (using AND operation) of n literals (variables).
B. Involution law. C. Absorption law. D. Demorgan’s law. Demorgan’s law states (X+Y)’=X’.Y’ and (X.Y)’=X’+Y’ is used to reduce the complexity of Boolean expression. B. X+X=X. C. X(X+Y)=X. D. X.X=1.1. X+X’ =1 is an inverse property and others are idemponent and involution laws. B. tautologies. C. false statements. D. unknown statements. A fallacy is an argument, which may convince others but is not logically sound. B. switch. C. ammeter. D. voltmeter. A switch is an electrical component, which can break an electrical circuit, interrupting the current or diverting it from one conductor to another. B. fallacies. C. truth values. D. closure values. Tautology is a statement of propositional logic, which holds for all truth-values of its atomic proposition. B. map rolling. C. map concatenation. D. map paging. Map rolling means roll the map i.e. consider the map as if its left edges are touching the right edges and top edges are touching bottom edges. B. black code. C. red code. D. green code. The binary code 00,01,11,10 is called gray code, as it differs only in one place. B. NAND and XOR. C. XNOR and OR. D. NAND and NOR. NAND and NOR are said to be universal gates as all the other gates can be made by using these two gates. B. OR. C. NOT. D. XOR. NOT gate is also known as inverter gate as the output is just the complement of the input. B. AND. C. NAND. D. NOR. In OR gate, the output is 1 when one or more inputs are 1. B. x(x’+y)=xy. C. y(x+y)=xy. D. xyz=1. Dual is obtained by changing each OR sign (+) to AND (.), each AND(.) sign to OR (+), replacing each 0 by 1 and 1 by 0. B. sum of all the literals C. Substraction of all the literals D. Multiplication of all the literals Minterm is a product of all the literals ( with or without the bar) within the logic system. B. AB. C. A’+B. D. A+B’. This can be proved by using the property x + xy = x. Here, x = (A+B)’ = A’B’ AND y=(C+D+E)’, therefore the result obtained is (A+B)'.
B. A’. C. 1. D. 0. The Boolean expression A+1 is equal to 1. Now, let A = A’. Then A’+1 = 1. B. AB. C. AB+CD+EF. D. A+B+C+D+E. Repeated application of absorption theorem, x + xy = x, gives the desired result.
B. CREATE TABLE Books(book_Code char(4), name char(15), author char(15), price number(4)); C. CREATE TABLE Books(book_Code char(4), name char(15), author char(15), price (4)); D. CREATE TABLE Books(book_Code char(4), name number(5), author char(15), price char(14)); Tables are defined with the CREATE TABLE command. When a table is created, its columns are named, data types and sizes are supplied for each column. Each table must have at least one column. B. There can be only one Primary Key for a table. C. By default output is displayed in ascending order. D. Aggregate functions work on individual rows. The Primary Key constraint declares a column as the primary key of the table. Only one column (or one group of columns) can be applied in this cpnstarint. The primary keys cannot allow NULL values, thus, this constraint must be applied to columns declared as NOT NULL. B. The WHERE and HAVING clauses are not interchangeable. C. The INSERT statement can omit a value for any column if it allows null or has a default value defined. D. A new table can be created from an existing table. SQL tables are comprised of table rows and columns. Table columns are responsible for storing many different types of data, like numbers, texts, dates, and even files. A table row is a horizontal record of values that fit into each different table column. B. not defined in the data dictionary. C. like a window to view data of a table. D. created from only one table. A view is like a window through which we can view or change information in a table. B. the ALTER STRUCT command. C. the UPDATE TABLE command. D. the ALTER TABLE command. The ALTER TABLE command is used to change the definitions of existing tables. It can add columns to a table. B. the ALTER TABLE command. C. D. the INSERT command. The UPDATE command lets us change some or all of the values in an existing row using the WHERE clause and the new data using the SET keyword. The new data can be specified constant, an expression or data from other tables. B. places conditions on groups. C. can be used in absence of GROUP BY clause. D. cannot be used with aggregate functions.SOLUTION
A. SELECT Marks FROM Student;SOLUTION
A. CREATE TABLE < table-name > (< datatype > [ (size) ], < data type > < size > );SOLUTION
A. UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'.SOLUTION
A. 03 JUL 00.SOLUTION
A. DDL.SOLUTION
A. DDL.SOLUTION
A. SELECT (DISTINCT) FROM employee;SOLUTION
A. SELECT count (*) FROM employee;SOLUTION
A. SELECT total (salary) FROM employee WHERE grade='A1';SOLUTION
A. adds columns in a table only.SOLUTION
A. DELETE FROM employee;SOLUTION
A. DELETE FROM table named employee WHERE salary > 5000;SOLUTION
A. only view names will be deleted from database.SOLUTION
A. DROP VIEW names.SOLUTION
A. if it has rows.SOLUTION
A. in creating the view.SOLUTION
A. an error.SOLUTION
A. it will return iti.SOLUTION
A. it will return *5.SOLUTION
A. DDL.SOLUTION
A. Data Control Language.SOLUTION
A. allow only null values.SOLUTION
A. places conditions on rows of the table.SOLUTION
A. DDL.SOLUTION
A. number.SOLUTION
A. specifies location of the table.SOLUTION
A. give one result per group.SOLUTION
A. Data Markup Language.SOLUTION
A. Simple Questioning Language.SOLUTION
A. SELECT.SOLUTION
A. DDL.SOLUTION
A. numberSOLUTION
A. SELECT * FROM item ;SOLUTION
A. SELECT, DELETE.SOLUTION
A. give one result per group.SOLUTION
A. SELECT * FROM tab1;SOLUTION
A. SELECT * FROM tab1;SOLUTION
A. specifies location of the table.SOLUTION
A. compare Boolean expressions.SOLUTION
A. Try to run fast.SOLUTION
A. minterms only.SOLUTION
A. logical table.SOLUTION
A. maxmin.SOLUTION
A. minterm.SOLUTION
A. Idempotent law.SOLUTION
A. X+X’=1.SOLUTION
A. fallacies.SOLUTION
A. trigger.SOLUTION
A. tautologies.SOLUTION
A. map twisting.SOLUTION
A. gray code.SOLUTION
A. AND and OR.SOLUTION
A. AND.SOLUTION
A. OR.SOLUTION
A. x(x’+y)=x+y.SOLUTION
A. product of all the literalsSOLUTION
A. (A+B)'SOLUTION
A.
A.SOLUTION
A. ABCDE.SOLUTION
A. CREATE TABLE Books(book_Code char(4), name char(15), author (15), price number(4));SOLUTION
The syntax of CREATE TABLE command is:
CREATE TABLE < table-name >
( < column name > < data type > [ ( size > ) ],
< column name > < data type > [ ( size > )... ] );
A. SOLUTION
For example,
CREATE TABLE student
( rollno integer NOTNULL PRIMARY KEY,
sname char(25) NOT NULL,
grade char(2));
A. A table can exist without rows and columns.SOLUTION
A. a table that stores data from another table.SOLUTION
A view is a virtual table i.e.,
(i) it looks like a table, but it does not exist as such
(ii) its data are derived from base table(s)
(iii) it only stores its defintion; it does not contain any copy of the data
A. the MODIFY command.SOLUTION
The syntax to add a column to a table is as follows:
ALTER TABLE < table name >
ADD < column name > < size >;
A. the UPDATE command.SOLUTION
A. places conditions on rows of the table.