Location via proxy:
[ UP ]
[Report a bug]
[Manage cookies]
No cookies
No scripts
No ads
No referrer
Show this form
Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
7 views
Import Theory Question - SQL
Computer
Uploaded by
prabumanikanda175
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Import Theory Question - SQL(1) For Later
Download
Save
Save Import Theory Question - SQL(1) For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
7 views
Import Theory Question - SQL
Computer
Uploaded by
prabumanikanda175
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Import Theory Question - SQL(1) For Later
Carousel Previous
Carousel Next
Save
Save Import Theory Question - SQL(1) For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 5
Search
Fullscreen
Important Theory Questions - Must Read SQL 1, Degree - It refers to the number of columns in a relation Cardinality - It refers to the number of rows in a relation 2. Domain - A domain is a set of values that can be assigned to an attribute 3. Keys in a Relational Database: (i) Primary Key It is an attribute or set of attributes that uniquely identifies a tuple in a relation. (ii) Candidate Key: The attributes of a table which are eligible to be set as primary key are called as candidate key. (iii) Alternate Key: From the list of candidate key one is chosen as primary key and the remaining are called Alternate key. (iv) Foreign Key: = A Foreign Key is a field (or collection of fields) in one table that uniquely identifies a row of another table. * It is used to establish a link between the data in two tables Candidate Key ‘Alternate Key Unique Key 4. Constraints: Constraints are certain types of restrictions on the data values that an attribute can have. Constraint pel eetelstoe NOT NULL Ensures that a column cannot have NULL values where NULL means missing/ unknown /not applicable value. UNIQUE Ensures that all the values in a column are distinct/unique. DEFAULT A default value specified for the column if no value is provided. PRIMARY KEY The column which can uniquely identify each row or record in a table. FOREIGN KEY The column which refers to value of an attribute defined as primary key in another table. © seaeed with OK Scanner5. Difference between Char and Varchar Data type: char varchar Used for fixed-length character Used for variable-length character strings. strings. It can store maximum of 255 It can store maximum of 65,535 characters characters It pads unused space with blanks | It holds only the characters assigned to it. Memory allocation is static ‘Memory allocation is dynamic Faster than VARCHAR due to fixed | Slower than CHAR due to variable size. length 6. SQL Commands: (i) DDL(Data Definition Language): > create > alter > drop > truncate (ii) DML(Data Manipulatrion Language): > insert > update > delete 7. Difference Primary Key and Unique Key Primary Key Unique Key Identifies an individual tuple uniquely in a relation Uniquely identifies each tuple (row) ina table. [or table, Only one primary key per table. Multiple unique keys can exist for a table, Does allow NULL values for the column. Allows NULL value for the column. Keyword used to assign constraint : primary key | Keyword used to assign constraint : unique 8: Characteristics of Primary key: + Aprimary key uniquely identifies each row (record) within a table. + It does not allow duplicate entries in a table. + The primary key attribute(s) cannot contain mull values. + There can be only one primary key attribute in a table. 9. where clause: The where clause is used to filter the records of a table based on the specified condition 10 . group by: GROUP BY statement is used to group rows based on values in one or more columns. It's particularly useful when you want to calculate aggregate values (such as count, average, sum, or maximum) for each group. © seaeed with OK Scanner11. Having Clause: + The HAVING clause in SQL is used to filter query results based on aggregate functions and groupings, «The HAVING clause allows you to filter groups of data after using the GROUP BY clause. 12. Order by: * The ORDER BY clause is used to sort the result set in either ascending or descending order based on one or more columns. + By default, the ORDER BY command sorts the result set in ascending order. + Ifyou want to sort the records in descending order, you can use the DESCkeyword. SELECT * FROM Customers ORDER BY CustomerName DES\ 13. Difference where and having ‘WHERE Clause HAVING Clause Used to filter rows of a table. ‘User to filter the grouped data. It can be used without GROUP BY clause. ‘To be used with GROUP BY clause. Operates on individual records. (Operates on grouped records. Applied before GROUP BY clause. Applied after GROUP BY clause. Cannot contain aggregate functions. ‘Can contain aggregate functions (e.g., SUM, COUNT). Used with SELECT, UPDATE, and DELETE statements. ‘Used only in SELECT statements. 14. Difference delete and ie Data Manipulation Language (DML) command. Data Definition Language (DDL) command. Used to remove records from a table. Used to (i) remove a table from a database (ii) remove a column or constraint from a table (iii) remove/delete a database Space occupied by the table in memory is not freed even if all tuples are deleted. Frees the table space from memory. Syntax DELETE FROM table_name WHERE condition; Syntax - To drop a table: DROP TABLE table_name; - To drop a database: DROP DATABASE database_name: Eg: To remove a record with empid = 1001 from employee table delete from employee where empid = 1001; Eg:To remove/delete the employee table: DROP TABLE employee; Actions can be rolled back. Actions cannot be rolled back. © seaeed with OK Scanner15. Difference Group by and order by: GROUP BY ORDER BY Itis used to groups rows based on the same value in specified columns. It is used sorts the result set in ascending or descending order based on one or more columns. Often used with aggregate functions (e.g., COUNT, SUM, AVG) to compute statistics for groups. Used to arrange the output rows. Requires an aggregate function (e.g., COUNT, SUM) when used. ‘Columns in the SELECT clause must be either part of the grouping columns or aggregate functions. ‘Does not require an aggregate function. ‘Can select any columns in the SELECT clause. SELECT columni, aggregate_function(column2) FROM table GROUP BY column1; SELECT column1, column2 FROM table ORDER BY column ASG; or SELECT column1, column2 FROM table ORDER BY column! DESC; ‘SQL Commands fi) Creating database: Syntax: Create database databaseName; Create database Class11b23; ) Selecting database: Syntax: Use databaseName; Use Class11b23; (iii) To view the available databases: Show databases; (iv) To create a table: Syntax: Create table tableName(col1Name datatype [constraint], Col2Name datatype [constraint], CoIN_Name datatype [constraint]); Student [Field | DataType | Constraint Roll int imary key. Name Varchar(20) not null ‘Age int DOB date Marks int default 20 Create table Student(Roll integer primary key, Name varchar(25) not null, Age integer, DOB date, Marks integer default 20); (v) To view table structure: Syntax: desc tableName; Eg: desc student; (or) describe tableName; (or) describe student; © seaeed with OK Scanner(vi) Inserting records into the table: Syntax: Insert into tableName values(col1 Value, col2Value,..... ColNValue); Eg. Insert into student values(1001, “Hari”, 14, “2009-05-22”, 80); (vii: Update a record: Syntax: Update tableName set colName = newValue where condition; Eg: ‘update student set marks = 94 where roll = 1002; (viii): Delete a record: Syntax: Delete from tableName where condition; Delete from student where roll = 1004; (ix| Add Column: ‘Syntax: Alter table tableName add colName datatype constraint; Eg: ‘Alter table student add class varchar(5); (x) Add Primary to existing table: ‘Syntax: ‘Alter table tableName add PRIMARY KEY (ColName); Eg: ‘Alter table student add primary key (roll); i) Remove Primary Key: Syntax: Alter table tableName drop Primary key; ‘Alter table student drop Primary key; (xii) Remove column: ‘Syntax: Alter table TableName drop colName; Eg: Alter table Student drop class; (xiii) Remove/delete table: ‘Syntax: Drop table tableName; Eg: Drop table Student; (xiv) View the available tables: show tables; (xv): Viewing the table, ing Table: Syntax: Select * from tableName where condition group by columnName having groupConditon order by columnName [asc| dsc]; Select que: © seamed vith one Seamer
You might also like
Codehelp: Lec-9: SQL in 1-Video
PDF
100% (1)
Codehelp: Lec-9: SQL in 1-Video
8 pages
Import Theory Question - SQL
PDF
No ratings yet
Import Theory Question - SQL
5 pages
My sql notes
PDF
No ratings yet
My sql notes
5 pages
Informatics Practices - Import Theory Question - SQL
PDF
No ratings yet
Informatics Practices - Import Theory Question - SQL
7 pages
Lab Manual PDF
PDF
No ratings yet
Lab Manual PDF
8 pages
SQL - Lab - part 1
PDF
No ratings yet
SQL - Lab - part 1
39 pages
SQL
PDF
No ratings yet
SQL
62 pages
Important MYSQL Commands
PDF
No ratings yet
Important MYSQL Commands
14 pages
XII CS Unit 3 Notes
PDF
No ratings yet
XII CS Unit 3 Notes
6 pages
Unit 2 - DATABASE CONCEPTS AND SQL 2
PDF
No ratings yet
Unit 2 - DATABASE CONCEPTS AND SQL 2
97 pages
Chapter-13 14 MySQL Class 12
PDF
No ratings yet
Chapter-13 14 MySQL Class 12
33 pages
Nasa FMEA Presentation
PDF
No ratings yet
Nasa FMEA Presentation
20 pages
IP 12th SQL
PDF
No ratings yet
IP 12th SQL
11 pages
Class 10 DBMS Queries Notes
PDF
No ratings yet
Class 10 DBMS Queries Notes
10 pages
DBNotes Updated
PDF
No ratings yet
DBNotes Updated
26 pages
cs new sm-103-122
PDF
No ratings yet
cs new sm-103-122
20 pages
DBMS & SQL
PDF
No ratings yet
DBMS & SQL
45 pages
SQL Notes
PDF
No ratings yet
SQL Notes
24 pages
Class 12:DATABASES MANAGEMENT SYSTEM AND SQL
PDF
No ratings yet
Class 12:DATABASES MANAGEMENT SYSTEM AND SQL
9 pages
dbms_practical_adivya_08 (1)
PDF
No ratings yet
dbms_practical_adivya_08 (1)
20 pages
Mysql Final
PDF
No ratings yet
Mysql Final
14 pages
12 Mysql Qs Notes
PDF
50% (2)
12 Mysql Qs Notes
18 pages
MySQL Theory Notes
PDF
No ratings yet
MySQL Theory Notes
6 pages
Lab1 Intro SQL&Ddl
PDF
No ratings yet
Lab1 Intro SQL&Ddl
4 pages
dbms lab manual
PDF
No ratings yet
dbms lab manual
72 pages
Data Questions
PDF
No ratings yet
Data Questions
10 pages
My-Sql: Learning Objectives
PDF
No ratings yet
My-Sql: Learning Objectives
22 pages
DBMS - Module - 3 Part 2
PDF
No ratings yet
DBMS - Module - 3 Part 2
96 pages
SQL Final
PDF
No ratings yet
SQL Final
44 pages
Structured Query Language (SQL)
PDF
No ratings yet
Structured Query Language (SQL)
46 pages
Dp Note Sss2 Second Term 2024-25
PDF
No ratings yet
Dp Note Sss2 Second Term 2024-25
19 pages
Chapter+2+ +Database+Query+Languages
PDF
No ratings yet
Chapter+2+ +Database+Query+Languages
64 pages
DBMS Package For Class Project: 13.1 Data Types in Oracle
PDF
No ratings yet
DBMS Package For Class Project: 13.1 Data Types in Oracle
34 pages
Unit 3 Database Management
PDF
No ratings yet
Unit 3 Database Management
22 pages
3.SQL Queries DDL
PDF
No ratings yet
3.SQL Queries DDL
49 pages
SQL CH 5
PDF
No ratings yet
SQL CH 5
26 pages
IP Class-XI Chapter-10 & 11 NOTES
PDF
100% (1)
IP Class-XI Chapter-10 & 11 NOTES
20 pages
sql
PDF
No ratings yet
sql
15 pages
Notes On MYSQL
PDF
No ratings yet
Notes On MYSQL
7 pages
SQL Revision Notes Question Bank
PDF
No ratings yet
SQL Revision Notes Question Bank
37 pages
5. Structured Query Language (SQL)for Final Exam
PDF
No ratings yet
5. Structured Query Language (SQL)for Final Exam
70 pages
SQL SERVER 2005 Study Material
PDF
No ratings yet
SQL SERVER 2005 Study Material
25 pages
BRIEF OF SQL AND NETWORKS
PDF
No ratings yet
BRIEF OF SQL AND NETWORKS
10 pages
Structuredquerylanguage 22222
PDF
No ratings yet
Structuredquerylanguage 22222
73 pages
Chapter 8 - Introduction To Structured Query Language (SQL)
PDF
No ratings yet
Chapter 8 - Introduction To Structured Query Language (SQL)
7 pages
SQL12
PDF
No ratings yet
SQL12
7 pages
SQL YouTube Course Notes The iScale
PDF
No ratings yet
SQL YouTube Course Notes The iScale
105 pages
SQL: Structured Query Language: Prepared By: Prof Momhamad Ubaidullah Bokhari
PDF
No ratings yet
SQL: Structured Query Language: Prepared By: Prof Momhamad Ubaidullah Bokhari
102 pages
SQL Basics
PDF
No ratings yet
SQL Basics
91 pages
SQL Question
PDF
No ratings yet
SQL Question
40 pages
DBMS Unit-3
PDF
No ratings yet
DBMS Unit-3
99 pages
SQL Short Notes
PDF
No ratings yet
SQL Short Notes
16 pages
SQL FULL REVISION
PDF
No ratings yet
SQL FULL REVISION
27 pages
Dbms Lab Controlled
PDF
No ratings yet
Dbms Lab Controlled
100 pages
Queries - Class of DB
PDF
No ratings yet
Queries - Class of DB
32 pages
SQL (Structured Query Language)
PDF
No ratings yet
SQL (Structured Query Language)
101 pages
FDB Lecture05
PDF
No ratings yet
FDB Lecture05
52 pages
SQL Differences
PDF
No ratings yet
SQL Differences
4 pages
sql notes
PDF
No ratings yet
sql notes
24 pages
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
Codehelp: Lec-9: SQL in 1-Video
PDF
Codehelp: Lec-9: SQL in 1-Video
Import Theory Question - SQL
PDF
Import Theory Question - SQL
My sql notes
PDF
My sql notes
Informatics Practices - Import Theory Question - SQL
PDF
Informatics Practices - Import Theory Question - SQL
Lab Manual PDF
PDF
Lab Manual PDF
SQL - Lab - part 1
PDF
SQL - Lab - part 1
SQL
PDF
SQL
Important MYSQL Commands
PDF
Important MYSQL Commands
XII CS Unit 3 Notes
PDF
XII CS Unit 3 Notes
Unit 2 - DATABASE CONCEPTS AND SQL 2
PDF
Unit 2 - DATABASE CONCEPTS AND SQL 2
Chapter-13 14 MySQL Class 12
PDF
Chapter-13 14 MySQL Class 12
Nasa FMEA Presentation
PDF
Nasa FMEA Presentation
IP 12th SQL
PDF
IP 12th SQL
Class 10 DBMS Queries Notes
PDF
Class 10 DBMS Queries Notes
DBNotes Updated
PDF
DBNotes Updated
cs new sm-103-122
PDF
cs new sm-103-122
DBMS & SQL
PDF
DBMS & SQL
SQL Notes
PDF
SQL Notes
Class 12:DATABASES MANAGEMENT SYSTEM AND SQL
PDF
Class 12:DATABASES MANAGEMENT SYSTEM AND SQL
dbms_practical_adivya_08 (1)
PDF
dbms_practical_adivya_08 (1)
Mysql Final
PDF
Mysql Final
12 Mysql Qs Notes
PDF
12 Mysql Qs Notes
MySQL Theory Notes
PDF
MySQL Theory Notes
Lab1 Intro SQL&Ddl
PDF
Lab1 Intro SQL&Ddl
dbms lab manual
PDF
dbms lab manual
Data Questions
PDF
Data Questions
My-Sql: Learning Objectives
PDF
My-Sql: Learning Objectives
DBMS - Module - 3 Part 2
PDF
DBMS - Module - 3 Part 2
SQL Final
PDF
SQL Final
Structured Query Language (SQL)
PDF
Structured Query Language (SQL)
Dp Note Sss2 Second Term 2024-25
PDF
Dp Note Sss2 Second Term 2024-25
Chapter+2+ +Database+Query+Languages
PDF
Chapter+2+ +Database+Query+Languages
DBMS Package For Class Project: 13.1 Data Types in Oracle
PDF
DBMS Package For Class Project: 13.1 Data Types in Oracle
Unit 3 Database Management
PDF
Unit 3 Database Management
3.SQL Queries DDL
PDF
3.SQL Queries DDL
SQL CH 5
PDF
SQL CH 5
IP Class-XI Chapter-10 & 11 NOTES
PDF
IP Class-XI Chapter-10 & 11 NOTES
sql
PDF
sql
Notes On MYSQL
PDF
Notes On MYSQL
SQL Revision Notes Question Bank
PDF
SQL Revision Notes Question Bank
5. Structured Query Language (SQL)for Final Exam
PDF
5. Structured Query Language (SQL)for Final Exam
SQL SERVER 2005 Study Material
PDF
SQL SERVER 2005 Study Material
BRIEF OF SQL AND NETWORKS
PDF
BRIEF OF SQL AND NETWORKS
Structuredquerylanguage 22222
PDF
Structuredquerylanguage 22222
Chapter 8 - Introduction To Structured Query Language (SQL)
PDF
Chapter 8 - Introduction To Structured Query Language (SQL)
SQL12
PDF
SQL12
SQL YouTube Course Notes The iScale
PDF
SQL YouTube Course Notes The iScale
SQL: Structured Query Language: Prepared By: Prof Momhamad Ubaidullah Bokhari
PDF
SQL: Structured Query Language: Prepared By: Prof Momhamad Ubaidullah Bokhari
SQL Basics
PDF
SQL Basics
SQL Question
PDF
SQL Question
DBMS Unit-3
PDF
DBMS Unit-3
SQL Short Notes
PDF
SQL Short Notes
SQL FULL REVISION
PDF
SQL FULL REVISION
Dbms Lab Controlled
PDF
Dbms Lab Controlled
Queries - Class of DB
PDF
Queries - Class of DB
SQL (Structured Query Language)
PDF
SQL (Structured Query Language)
FDB Lecture05
PDF
FDB Lecture05
SQL Differences
PDF
SQL Differences
sql notes
PDF
sql notes