MYSQL Commands Class10
MYSQL Commands Class10
Important Terms :
1) Primary Key : A primary key is a field or group of fields that uniquely identifies a
row/record/tuple in a table. It can not be null(blank).
3. Foreign key : The foreign key identifies a column or set of columns in one
(referencing:child) table that refers to a column or set of columns in another
(referenced: parent) table where it acts as a primary key.it helps in maintaining
referential integrity.
4. Candidate key: Any field or group of fields that could be a primary key is called
candidate key.
1) Table : A table is a set of data elements (values) that is organized using a model
of vertical columns and horizontal rows.
Or
● A row also called a Record or Tuple represents a single data item in a table.
● Every row in the table has the same structure.
Or
Table: Student
1 Amit A 90
2 Sumit A 80
4. Attributes/fields are column name like rno,Name,sec and Marks
Ans. 2( no of rows)
Q3. write down the name of the attribute that can act as a primary key in the above
table student?
Ans. rno
Student
Parent/master: PK(RollNo)
Rollno name fname class
1 Sumita fsjgdj 9
2 Amit fdsfsd 9
Marks:Child table
FK(Rollno)
Rollno Eng Maths Sci
1 60 50 70
2 75 65 98
3. Define relationship?
The association between tables(relation) defines the relationship.
4. Write down different types of relationships in DBMS?(2-3 marks)
There are three types of relation that exist between tables:
1. One to one:
This means one record in one table has exactly a matching record in
a related table. For example in the student and mark table we can enter
only one entry of a student against marks.
2. One to Many:
This means one record in one table has many matching records in
a related table. For example, a teacher can teach many subjects.
3. Many to Many:
This means multiple records in one table have many matching
records in another related table.
In this relationship, no table has the primary key column.
E.g students can pursue as many courses as they want.
MYSqL Queries:(4-5 Questions)
Define query?
Query is used to display specific information from a pool of data.
It helps us to join information from different tables and filter that data.
Define filtering?
It means that the query uses criteria/conditions to provide it to hide
some data and display the respective data that matches the criteria.
Define Mysql (MY structured query language)
It is a query language used to make queries into databases.
Different Categories of commands
1. DDL
2. DML
3. DCL
4. TCL
Table: Student
1 Amit A 90
2 Sumit A 80
rno->integer
name->varchar
Sec ->varchar
marks->integer
Write down the name of the command used to design a table?
Write down the name of the command used to add a record in a table?
We use insert command
Syntex:
Insert into tablename values (fieldvalue1, “value2”, “value3”,---);
Write down the name of the command used to modify a record in a table?
We use update command
Syntex:
update tablename set columnname=new value where condition;
E.g.
Write a sql command to modify copies of book id 100 as 4;
Ans.
update book set copies=4 where bookid=100;
select price from book where author="Tom Clancy";
E.g.
Student
Parent/master: PK(RollNo)
Rollno name fname class
1 Sumita fsjgdj 9
2 Amit fdsfsd 9
Q. Write down the various field properties for numeric data type?(2 marks)
Ans.
AutoValue – if set to yes then the field will get the auto numeric values.
Length – By default length of the field is 10 but the size of the field can be set to
maximum length.
Default Value – A default value can be set for a field if user doesn't provide any
value while entering the values in the table.
Format example – This property helps to set the format of the data entered in the
field such as 91-222-333
Q. Write down the various field properties for character data type?
Ans. The various properties of character type data is s
Entry Required – if set to yes then it will be must to insert the value in the field
which means that field cannot be left blank.
Length – By default length of the field is 10 but the size of the field can be set to
maximum length.
Default Value – A default value can be set for a field if user don’t provide any value
while entering the values in the table.
Q. Define sorting ?
Ans. Sorting means to arrange the data in either ascending order of descending
order.
Select the column(s) then click on sort buttons. The data will be displayed
accordingly.
ASSESSMENT
Fill in the blanks:
1. The types of languages used for creating and manipulating the data in the
Database are ______________ & ______________.
2. A ____________________ is a standard for commands that define the
different structures in a database.
3. A ______________ is a language that enables users to access and
manipulate data in a database.
4. A _____________ is a part of DML involving information retrieval only.
5. A popular data manipulation language is _________________
6. __________ are the basic building blocks of a database.
7. There are __________ types of Relationships in a table.
Short Answer Questions:
1. What is the file extension for databases created using OpenOffice.Org
Base?
2. List any three file formats that can be managed using OpenOffice.Org
Base?
3.How many types of relationships can be created in Base? Explain each of
the them.
4.What do you mean by Sorting? In how many ways it can be done?
5.Explain Referential Integrity with the help of an example.
MYSQL