Select 8.name from 8,9 where 8.name == 9.name
Select 8.name from 8 MINUS Select 9.name from 9;
Select 8.name from 8 where 8.name not in (select 9.name from 9).
IN is most expensive in terms of performance, you can use having clause or something else...
The primary key consists of one or more columns whose data contained within is used to uniquely identify each row in the table.
ex- Aadhaar Number, Social Security Number, Passport Numbers can be set as Primary to uniquely identify persons in Peoples table.
A foreign key is a set of one or more columns in a table that refers to the primary key in another table.
ex-this person belongs to a department - department id is a primary key in department table.
In Peoples table you can put foreign key department id which points to department id [The primary key ] of
Database normalization is a process used to organize a database into tables and columns.
The idea is that a table should be about a specific topic and that and only supporting topics included.
By limiting a table to one purpose you reduce the number of duplicate data contained within your database.
This eliminates some issues stemming from database modifications.
Why you will not put all the data in a single table ?
Splitting up of all data into several tables and later fetch data by sql queries.
There are three main reasons to normalize a database.
The first is to minimize duplicate data,
the second is to minimize or avoid data modification issues,
and the third is to simplify queries.
There are three common forms of database normalization: 1st, 2nd, and 3rd normal form.
They are also abbreviated as 1NF, 2NF, and 3NF respectively.
There are several additional forms, such as BCNF,
Boyce-Codd normal form (or BCNF or 3.5NF) is a normal form used in database normalization.
It is a slightly stronger version of the third normal form (3NF).
BCNF was developed in 1974 by Raymond F Boyce and Edgar F Codd to address certain types of anomalies not dealt with by 3NF as originally defined.
If you create an index on tables, search will be faster as they internally use BST - binary search tree
traversing through a large table of comments section of a blog to find those for the relevant post would be expensive
Because you possibly believe that a linear search will be done every time taking O(n) time. For a billion comments, a billion iterations will be done.
Now suppose a binary search tree is constructed for comment_ID on comments table.
To look up any comment, you need log(n) time [base 2].
So for even 1 billion comments, only around 32 iterations will be needed.
2 ^ 32 = 2^10 * 2^10 * 2^10 * 2^2
1 billion = 2^9 1024*1024*1024
Now consider a slightly modified BST, where each node contains k elements instead of 1 (in a list) and has k+1 children nodes.
The same properties of BST are followed in this data structure as well. What we've got here is called a B-tree.
For a B-Tree, the lookup time is log(n) [base k]. Hence, if k=10, for 1 billion entries, only 9 iterations will be needed.
All databases save indexes for primary keys in B-Trees. Hence, the stated task would not be expensive, and you should go ahead and design the database the way it seemed obvious.
PS: You can build an index on any column of the table. By default primary key indexes are already stored. But be careful, do not make unnecessary indexes as they take up disk space.
More reading : B Tree
RDBMS. Stands for "Relational Database Management System."
An RDBMS is a DBMS designed specifically for relational databases. Therefore, RDBMSes are a subset of DBMSes.
A relational database refers to a database that stores data in a structured format, using rows and columns.
There is a relationship between data in each row and relationships between tables.
Apart from RDBMS, there are object databases also there.
A cursor is a pointer used to fetch rows from a result set. One can think of a cursor as a data structure that describes the results returned from a SQL SELECT statement. One of the variables in this structure is a pointer to the next record to be fetched from the query results.
Note that if you do repetitive stuff inside a loop and you fail to close your cursors, you would soon run into the ORA-01000: maximum number of open cursors exceeded error.
equi join, non equi join, cross join, self join, inner join or simple join, left outer join, right outer join, full outer join
Set operations allow the results of multiple queries to be combined into a single result set.
Set operators include UNION, INTERSECT, and EXCEPT.
The SQL UNION operator is used to combine the result sets of 2 or more SELECT statements.
It removes duplicate rows between the various SELECT statements.
Each SELECT statement within the UNION must have the same number of fields or columns in the result sets with similar data types.
Ads By Google
© 2018 - JavaSpartans.com • All Rights Reserved