| Class XII |
Computer Science |
Computer Science |
9 |
some of the commonly used constraints in SQL. They are used to ensure correctness of data. However, it is Key constraint? not mandatory to define c... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
, we will type following command at mysql prompt. 134 C omputerScienc- ClasXII Reprint 2026-27 mysql> CREATE DATABASE StudentAttendance; Query OK, ... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
characters VARCHAR(30) NOT NULL Table 9.5 Data types and constraints for the attributes of relation ATTENDANCE. Attribute Name Data expected to be ... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
StudentAttendance database. So far, we Activity 9.4 have only the STUDENT table. Create the other two mysql> SHOW TABLES; relations GUARDIAN +-----... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
• Data types and size of referenced and referencing attributes must be the same. Syntax: ALTER TABLE table_name ADD FOREIGN KEY(attribute name) REF... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
data type INT in the table GUARDIAN. mysql> ALTER TABLE GUARDIAN -> ADD income INT; Query OK, 0 rows affected (0.47 sec) Records: 0 Duplicates: 0 W... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
(0.08 sec) Records: 0 Duplicates: 0 Warnings: 0 Note: We have to specify the data type of the attribute along with DEFAULT while using MODIFY. (H) ... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
created the database StudentAttendance having three relations STUDENT, GUARDIAN and ATTENDANCE. When we create a table, only its structure is creat... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
1 row affected (0.01 sec) We can use the SQL statement SELECT * from table_name to view the inserted records. The SELECT statement will be explaine... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
given in Table 9.7 into the STUDENT table. Table 9.7 STUDENT Table RollNumber SName SDateofBirth GUID 1 Atharv Ahuja 2003-05-15 444444444444 2 Daiz... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
• Which of the two certain attributes, as shown in the following query: insert statement mysql> INSERT INTO STUDENT (RollNumber, SName, should be u... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
the same -> WHERE RollNumber = 1; can be helpful. +--------------+--------------+ | SName | SDateofBirth | +--------------+--------------+ | Atharv... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
| 180000 | | Nachaobi | 348000 | | Daribha | 504000 | | Tanya | 600000 | +----------+---------------+ 10 rows in set (0.00 sec) Note: Annual Income... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
such conditions. The logical operators AND, OR, and NOT are used to combine multiple conditions. Example 9.4 Display all the details of those emplo... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
Ename | DeptId | +----------+--------+ | Shabbir | D01 | | Joseph | D03 | | Sanya | D02 | | Nachaobi | D05 | | Daribha | D04 | | Tanya | D05 | +---... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
Daribha | 42000 | NULL | D04 | +-------+----------+--------+-------+--------+ 7 rows in set (0.00 sec) (E) Membership operator IN The IN operator c... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
ORDER BY clause is used to display data in an ordered form with respect to a specified column. By default, ORDER BY displays records in ascending o... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
a bonus (i.e., Bonus is not null) and works in the department D01. mysql> SELECT EName FROM EMPLOYEE -> WHERE Bonus IS NOT NULL -> AND DeptID = ‘D0... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
mysql> SELECT * FROM EMPLOYEE with the process? -> WHERE Ename like '%a' -> AND Salary > 45000; List other real-life situations where +-------+----... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
data manipulation methods on the StudentAttendance database given in section 9.4. 9.7.1 Data Updation We may need to make changes in the value(s) o... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
| +------------+---------------+------------+--------------------------------------+ |444444444444|Amit Ahuja |5711492685 |G-35, Ashok vihar, Delhi... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
us create a database called CARSHOWROOM having the schema as shown in Figure 9.2 It has the following four relations: 1) INVENTORY: Stores name, pr... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
| 5527688761 | rehnuma@hotmail.com | | C0003 | Charvi Nayyar| 10/9, FF, Rohini | 6811635425 | charvi123@yahoo.com | | C0004 | Gurpreet | A-10/2, SF... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
returns zero or more values as a result. Functions are useful while writing SQL queries also. Functions can be applied to work on single or multipl... |
|
| Class XII |
Computer Science |
Computer Science |
9 |
offer his customers to pay the total amount in 10 easy EMIs (equal monthly instalments). Assume that EMIs are required to be in multiples of 10000.... |
|