YouTube2Text

Introduction to SQL/1 — Transcript

by Data Base Management System - IITKGP · 3,787 words · 744 segments · language en · Watch on YouTube

Full transcript

  1. 0:00[Music]
  2. 0:15welcome to
  3. 0:17module six of
  4. 0:20database management systems
  5. 0:22this is the starting of ah week two
  6. 0:26in week one
  7. 0:28ah we have done five modules
  8. 0:32ah after the
  9. 0:33overview of the course we have primarily
  10. 0:35introduced the basic notions of
  11. 0:38dbms
  12. 0:39and we have discussed about the
  13. 0:42relational model the fundamentals of it
  14. 0:46in this background in
  15. 0:48this week
  16. 0:50we are
  17. 0:52primarily focusing on the
  18. 0:55query language
  19. 0:57the structured query language sql
  20. 1:00so all the five modules will relate to
  21. 1:03discussions on query language
  22. 1:06and
  23. 1:08this module 6 7 and eight the three
  24. 1:11modules will
  25. 1:13introduce sql at a first level
  26. 1:17and
  27. 1:18the last two modules
  28. 1:22eight and nine
  29. 1:23i am sorry nine and ten
  30. 1:25will discuss about intermediate that is
  31. 1:28somewhat advanced level of features in
  32. 1:31the sql
  33. 1:33the objective of the current module is
  34. 1:35to understand the relational query
  35. 1:37language
  36. 1:38and particularly the data definition and
  37. 1:42the basic query structure
  38. 1:44that
  39. 1:45will hold for all sql queries
  40. 1:49ah particularly this
  41. 1:53the modules this week
  42. 1:55would be important for writing any kind
  43. 1:58of database applications squaring the
  44. 2:01database to find information from the
  45. 2:04existing data and to manipulate it so
  46. 2:07please
  47. 2:09put a lot of focus in the whole material
  48. 2:12of this week and practice them well to
  49. 2:15understand the basic issues of database
  50. 2:18systems in a
  51. 2:20depth in depth in a well oriented manner
  52. 2:24ah in this module we will first talk
  53. 2:27about the history and then we will
  54. 2:30see how to define data and start
  55. 2:33manipulating them
  56. 2:36sql was
  57. 2:38originally called
  58. 2:40ibm sequence language sql language and
  59. 2:43was a part of system r
  60. 2:46it was subsequently renamed as
  61. 2:48structured query language
  62. 2:50and like any other good
  63. 2:54programming language that we have
  64. 2:57sql also gets standardized by ansi and
  65. 3:00iso and there have been several
  66. 3:03standards of sql
  67. 3:05that has come up
  68. 3:07with sql 92 being the most
  69. 3:10popular one
  70. 3:12and
  71. 3:13the commercial
  72. 3:15system most of them
  73. 3:17try to provide support for sql 92
  74. 3:20features
  75. 3:21but they do vary between themselves so
  76. 3:25it is possible that the examples that we
  77. 3:27show here
  78. 3:29may or may not
  79. 3:31all of them execute
  80. 3:33in the system that you are using so you
  81. 3:35will have to look at what standard
  82. 3:38your system is actually following
  83. 3:41ok so the first what we will talk about
  84. 3:44is the ddl data definition language as
  85. 3:47we had discussed earlier this is
  86. 3:51the features to
  87. 3:53create
  88. 3:54the schema the tables in a database
  89. 3:57management system
  90. 3:59so it allows for
  91. 4:00the creation or definition of the schema
  92. 4:03for each relation that we have in the
  93. 4:05database
  94. 4:06it specifies the domain of values
  95. 4:09associated with each attribute of the
  96. 4:12schema
  97. 4:13and it also defines a variety of
  98. 4:15integrity constraints
  99. 4:17later in the course we will see that it
  100. 4:20also has to specify other related
  101. 4:23information like indexing security
  102. 4:25authorization
  103. 4:26physical storage and so on
  104. 4:31so first the domain of possible values
  105. 4:34we have already specified that
  106. 4:37every domain in sql is more of an atomic
  107. 4:41nature
  108. 4:42so they are more like the primitive or
  109. 4:44built in data types of languages like c
  110. 4:47c plus plus java
  111. 4:49so the common
  112. 4:51domain types are character ah which are
  113. 4:54basically strings of character having a
  114. 4:56certain length
  115. 4:58then you can have
  116. 5:00variable character string which means
  117. 5:02that the length here specifies that
  118. 5:06the maximum length that the string can
  119. 5:08take but a string could be shorter than
  120. 5:10that
  121. 5:11integer obviously ah then small integer
  122. 5:14which in a system may give a smaller
  123. 5:17range of integer values
  124. 5:19then there is a numeric type which is
  125. 5:21often very important which says what is
  126. 5:25the
  127. 5:27precision of the numbers that are to be
  128. 5:30written in this format stored in this
  129. 5:32format so d basically gives that
  130. 5:35precision value and p gives a size ah
  131. 5:38then you can have a real and double
  132. 5:40precision numbers you have can have
  133. 5:42floating point numbers and so on and
  134. 5:45there are some more ah data types which
  135. 5:47will discuss later in the course
  136. 5:51given all these
  137. 5:53domain types so what we will try to do
  138. 5:55is
  139. 5:57here is a schema for the university
  140. 5:59database which has
  141. 6:01multiple different
  142. 6:03relations
  143. 6:04designed in that showing the attributes
  144. 6:07and marking out what are the keys and
  145. 6:09what are the foreign keys so we would
  146. 6:12take
  147. 6:13examples of some of these and try to
  148. 6:16code them in the sql
  149. 6:20now to create a table this is how you go
  150. 6:23about
  151. 6:25the
  152. 6:26sql keyword create table is a basic
  153. 6:29command
  154. 6:30so with the create table you have to
  155. 6:32specify a name
  156. 6:34here
  157. 6:35the name that
  158. 6:37is given is in terms of this
  159. 6:40name r which is the name of the relation
  160. 6:43and then you provide a
  161. 6:45series of
  162. 6:47attributes separating by comma
  163. 6:50a i's are different attributes and for
  164. 6:52every attribute there is a corresponding
  165. 6:56type domain type specified so it says
  166. 6:59that a 1 is of domain type d one a two
  167. 7:01is of domain type d two and so on
  168. 7:04and all of these attribute descriptions
  169. 7:06are then followed by
  170. 7:08a series of integrity constraints it is
  171. 7:11possible that a create table may not
  172. 7:14provide any constraint
  173. 7:16but often you will have a number of
  174. 7:18constraints to work with
  175. 7:21so
  176. 7:24here is one example
  177. 7:27so
  178. 7:28in this
  179. 7:29we are trying to
  180. 7:32code the creation of this instructor
  181. 7:35table
  182. 7:36as you can see it has
  183. 7:38four different fields
  184. 7:40id
  185. 7:41name department name and salary and for
  186. 7:45each one we have specified the domain
  187. 7:47type so id is care5 this means that the
  188. 7:50ident id of this table instructor
  189. 7:54will be strings of length
  190. 7:56five whereas the name or the department
  191. 7:59name
  192. 8:00are strings
  193. 8:02but
  194. 8:03they have a maximum length 20 but they
  195. 8:05could have been of variable length
  196. 8:07whereas salary is a is of numeric type
  197. 8:10having specification eight two so it can
  198. 8:13have two decimal places and be of size
  199. 8:15eight maximum
  200. 8:17so this is the basic uh form of ah
  201. 8:19definition that we have for creating a
  202. 8:22table defining a table or defining a
  203. 8:24schema
  204. 8:27now we can add a number of integrity
  205. 8:30constraints
  206. 8:31to the create table
  207. 8:333 integrity constraints
  208. 8:35we will discuss here one is not null one
  209. 8:39is primary key and other third is
  210. 8:42foreign key so not null will specify
  211. 8:44whether a field can be null or not
  212. 8:47primary key as we have seen will specify
  213. 8:49the attributes which form the primary
  214. 8:51key
  215. 8:52and the foreign key will specify the
  216. 8:54attributes which reference
  217. 8:56some other table
  218. 8:58and are
  219. 9:00key in that table
  220. 9:02so
  221. 9:03here is an example
  222. 9:05the instructor
  223. 9:07in the instructor
  224. 9:09[Music]
  225. 9:12relation here we have we had seen this
  226. 9:15part the attribute what we have added
  227. 9:18here is
  228. 9:19this not null
  229. 9:21so we say the name is not null which
  230. 9:23means that
  231. 9:24in the instructor table it is not
  232. 9:27possible to insert
  233. 9:29a record
  234. 9:31where the name of the instructor is null
  235. 9:34that is unknown but it is possible it
  236. 9:37the same thing is not said about ah
  237. 9:40department name same thing is not said
  238. 9:42about salary so it is possible that
  239. 9:44these could be null
  240. 9:46now
  241. 9:48we additionally say that
  242. 9:52primary id primary key is id so this
  243. 9:55field id is a primary key
  244. 9:58and it is a property of sql
  245. 10:01create table command that if an
  246. 10:04attribute is
  247. 10:06referred as a primary key then it cannot
  248. 10:09be not null so
  249. 10:11you do not need to specify that is here
  250. 10:14you do not need to write
  251. 10:16not null
  252. 10:17because it is a primary key it will
  253. 10:20be known to be not null because
  254. 10:23certainly
  255. 10:24we have discussed that key is the
  256. 10:26distinguishing attribute in a database
  257. 10:29table so it cannot be null so it will
  258. 10:31not be able to distinguish
  259. 10:34similarly
  260. 10:35we have finally we have the
  261. 10:37third integrity constant which is
  262. 10:39foreign key which says that it is
  263. 10:42referencing
  264. 10:43this table
  265. 10:45department
  266. 10:47and the foreign key of this is here the
  267. 10:50department name the depth name
  268. 10:53this particular field is a foreign key
  269. 10:55which will which is a key of the
  270. 10:58department table
  271. 11:00and
  272. 11:01so we will be able to
  273. 11:03refer this
  274. 11:05from this table as a foreign key and we
  275. 11:07know that it is a will be a key in the
  276. 11:10department table
  277. 11:12so these are the
  278. 11:14ways to specify the integrity constraint
  279. 11:18ah
  280. 11:21so
  281. 11:24here are a couple of more examples so i
  282. 11:26will not go through them in detail
  283. 11:30i will
  284. 11:31request you to take time and carefully
  285. 11:35understand them
  286. 11:36again these are
  287. 11:38about
  288. 11:39different
  289. 11:40relations that exist here about the
  290. 11:42student
  291. 11:44and about the courses that the student
  292. 11:46take
  293. 11:47and
  294. 11:48in every case we have specified the set
  295. 11:51of fields that you have in the table
  296. 11:53in the
  297. 11:54design of the schema are listed in the
  298. 11:57create table
  299. 11:58the id information about the
  300. 12:01primary key is provided and also the
  301. 12:04information about the foreign key here
  302. 12:06department name is the foreign key which
  303. 12:08is mapping to this point similar things
  304. 12:11can be observed about the text
  305. 12:13relationship which space show
  306. 12:16the
  307. 12:17how students are actually taking courses
  308. 12:21so it ah
  309. 12:22relates ah different
  310. 12:25it has a set of fields but
  311. 12:27it has two kinds of primary
  312. 12:29ah
  313. 12:30foreign keys
  314. 12:32one that relate to the student through
  315. 12:34the id
  316. 12:35and this combination this combination of
  317. 12:39attributes which refer to the section
  318. 12:44so this is how different
  319. 12:47[Music]
  320. 12:49tables can be created using the
  321. 12:52data definition language
  322. 12:54here is a note
  323. 12:56that you should observe that if you
  324. 12:59consider
  325. 13:01this section id
  326. 13:03the section id is a part of the primary
  327. 13:06key which means
  328. 13:07that two records cannot be
  329. 13:12same
  330. 13:13if they are
  331. 13:14if they if they are different in the
  332. 13:17section id
  333. 13:18then such records are allowed so which
  334. 13:20means that
  335. 13:22it is possible that a student can
  336. 13:25attend
  337. 13:27or take a course
  338. 13:29in the same semester in the same year
  339. 13:32with two different section ids because
  340. 13:34they are primary keys so they can be
  341. 13:36different
  342. 13:37so if we drop this from the primary key
  343. 13:40then we will enforce the condition
  344. 13:42that no student will be able to take a
  345. 13:46course
  346. 13:47in two sections in the same semester and
  347. 13:50the same year so this is these are the
  348. 13:52different design choices that we have
  349. 13:55and we will move on ah here is one more
  350. 13:59example trying to show you the create
  351. 14:02table command for the course
  352. 14:07relation that we have in the
  353. 14:09university database
  354. 14:11moving on let us look at how to update
  355. 14:15or
  356. 14:16actually put in
  357. 14:18different records in a table which has
  358. 14:21already been created the basic command
  359. 14:24is insert and
  360. 14:26the keywords
  361. 14:28for that is insert into
  362. 14:30and values in between you write the name
  363. 14:32of the relation
  364. 14:34where the record will have to be
  365. 14:35inserted and then the values will have
  366. 14:38to be
  367. 14:40put as a tuple
  368. 14:42in the same order in which you would
  369. 14:44have defined the attributes of that
  370. 14:47relation
  371. 14:48and certainly each of the values like
  372. 14:51this is id value next is the name value
  373. 14:53the department the salary each one of
  374. 14:56them
  375. 14:57should be from the same domain type as
  376. 15:00has been specified during the create
  377. 15:02table
  378. 15:03command
  379. 15:05so these things will have to remember
  380. 15:07and
  381. 15:08so every record will get inserted
  382. 15:10through one insert command
  383. 15:12similarly a
  384. 15:14deletion can be done by delete from
  385. 15:17students if you do delete from students
  386. 15:19without specifying
  387. 15:21ah which record you want to delete
  388. 15:23basically all records will get deleted
  389. 15:26we will see how selective deletion will
  390. 15:28happen that will come on later
  391. 15:31drop table is a command to remove a
  392. 15:34table a table that has been created can
  393. 15:36be removed from the database all
  394. 15:38together by doing drop table and the
  395. 15:40relation name
  396. 15:42you can also change the schema of a
  397. 15:44table by using alt table so the form is
  398. 15:49alter table is a
  399. 15:50the keywords
  400. 15:51you can add a new
  401. 15:54attribute to relation r
  402. 15:56by writing the name of the attribute and
  403. 15:58the domain of the attribute one after
  404. 16:01the other
  405. 16:02similarly it is possible also
  406. 16:06to drop an attribute that already exist
  407. 16:10and
  408. 16:11the
  409. 16:12syntax for that will be at alter table
  410. 16:15the relation name drop is the keyword
  411. 16:18and the name of the attribute mind you
  412. 16:20all database systems may not allow you
  413. 16:24to
  414. 16:24drop an attribute to alter table to
  415. 16:27remove attributes and so it works in
  416. 16:30some and it does not work in the rest
  417. 16:34now let us so that was about the ah
  418. 16:37definition
  419. 16:38of the table and the basic definition of
  420. 16:41the data so now we will get into the
  421. 16:45basics query structure which is ah with
  422. 16:47tables with existing data how do i query
  423. 16:51and find out different information
  424. 16:54so the structure of an sql query and
  425. 16:57this you should
  426. 16:59observe very carefully
  427. 17:01is
  428. 17:02normally said to be select from where
  429. 17:04colloquially we will often say ah let us
  430. 17:06have a select from where
  431. 17:08so
  432. 17:09it has three keywords select which is
  433. 17:12followed by a set of this is a set of
  434. 17:15attributes
  435. 17:16so this specifies that when a select
  436. 17:20query runs it will finally give us a new
  437. 17:23relation
  438. 17:25and in that relation
  439. 17:27the attributes that will be
  440. 17:31available are the attributes that
  441. 17:33feature in the select list
  442. 17:37the next
  443. 17:38clause or the next
  444. 17:40keyword in this is from
  445. 17:42which specifies a set of existing
  446. 17:45relations
  447. 17:46so r one r two r m represent different
  448. 17:50relations
  449. 17:51and these are the relations which will
  450. 17:53be used to actually find the information
  451. 17:57extract the information
  452. 17:59finally the where clause has a predicate
  453. 18:02as a condition
  454. 18:03which specify that what condition
  455. 18:07has to be satisfied so that
  456. 18:10certain tuples from the relations r 1 to
  457. 18:14r m
  458. 18:15will be chosen and put in this new
  459. 18:19selected result table in terms of the
  460. 18:21attributes a 1 to a n
  461. 18:24so this is the basic
  462. 18:26understanding of the or structure of the
  463. 18:29ah
  464. 18:31sql query
  465. 18:32and naturally as i have mentioned that
  466. 18:35it will result in a relation
  467. 18:37now we will go over each and every
  468. 18:39clause carefully the select clause as i
  469. 18:42said will list all the
  470. 18:44attributes so it is like a projection in
  471. 18:47terms of the relational algebra that we
  472. 18:49have done
  473. 18:50so
  474. 18:52if we write select name from instructor
  475. 18:55then
  476. 18:56this will result in
  477. 18:58finding the names of all instructors
  478. 19:02from the instructor table because this
  479. 19:04is
  480. 19:05ah this you know is a relation because
  481. 19:07it is happening
  482. 19:09it is featuring in the from clause
  483. 19:11and in select we are saying that the
  484. 19:13attribute that we want to select is the
  485. 19:15attribute name
  486. 19:16so it will
  487. 19:18the instructor table has four attributes
  488. 19:22id name
  489. 19:23depth name and salary from that it will
  490. 19:26simply take the name of the instructor
  491. 19:28and list that in the
  492. 19:30output table
  493. 19:33so the basic form of selection that
  494. 19:35happens
  495. 19:36ah at this point you may also note that
  496. 19:38in sql ah everything is ah case
  497. 19:42insensitive it does not matter whether
  498. 19:43you write in upper case or lower case so
  499. 19:46you can choose the style that you prefer
  500. 19:48ah to use
  501. 19:52this is a
  502. 19:53very important factor that you should
  503. 19:55keep in mind that we said
  504. 19:58while introducing relational algebra
  505. 20:00that in the relational algebra
  506. 20:04everything is a every relation is a set
  507. 20:07and which means that according to set
  508. 20:09theory we cannot have two tuples in the
  509. 20:13same relation which are identical in all
  510. 20:15its values because set theory does not
  511. 20:18allow that
  512. 20:19but please ah keep in mind that sql
  513. 20:22actually allows duplicates in relations
  514. 20:25so it is possible that in the same
  515. 20:28relation in the same table i may have
  516. 20:31more than one
  517. 20:32record which are identical in all the
  518. 20:36fields in all the attributes of that
  519. 20:39table
  520. 20:40and this will have lot of consequences
  521. 20:43and will see how often
  522. 20:44this property will
  523. 20:46have to be used so if you want a typical
  524. 20:50set theoretic kind of output
  525. 20:53that is if you want the relations to be
  526. 20:56the result to be distinct all records to
  527. 20:58be distinct then you have to explicitly
  528. 21:01say that
  529. 21:02you want
  530. 21:03distinct values to be selected so all
  531. 21:05that you are doing is you are after
  532. 21:08select and before the attribute name you
  533. 21:10introduce another keyword distinct
  534. 21:13so
  535. 21:14select distinct depth name from
  536. 21:15instructor will actually select
  537. 21:18the departments of all instructors
  538. 21:21and
  539. 21:22quite well if it just selects ah
  540. 21:24department name of all instructor then
  541. 21:26it is quite possible that the same
  542. 21:28department name will appear number of
  543. 21:30times because
  544. 21:32every department has multiple
  545. 21:33instructors
  546. 21:35but when we use
  547. 21:36distinct then the every name will
  548. 21:38feature only once in that selection
  549. 21:44then you can also specify another
  550. 21:47keyword all
  551. 21:48which
  552. 21:49ensures that the duplicates are not
  553. 21:52removed so if you do select all depth
  554. 21:54name then all the names will feature
  555. 21:57with duplicate so if some department had
  556. 22:00three instructors the name of that
  557. 22:02department will feature thrice
  558. 22:05you can use
  559. 22:06an asterisk
  560. 22:08after select to specify that you are
  561. 22:10interested in all the attributes that
  562. 22:13the relation
  563. 22:14or the collection of relations in the
  564. 22:16from clause has
  565. 22:19you can also specify
  566. 22:22a select
  567. 22:23with a literal and without a from clause
  568. 22:28if you do that then it will simply
  569. 22:30return you a table with a single row
  570. 22:33having that literal value and you can
  571. 22:35also rename that ah table using ah what
  572. 22:39is known as the as clause
  573. 22:42ah as
  574. 22:43command
  575. 22:44so this will give you a table foo
  576. 22:47where there is only one row and that row
  577. 22:50has an entry 437
  578. 22:56you can use that for other purposes also
  579. 22:59you can
  580. 23:00do a select of a literal from a table
  581. 23:03with
  582. 23:04using a from clause wherein ah you will
  583. 23:08get a single column table where as many
  584. 23:12a's as there are records in the
  585. 23:13instructor will be produced
  586. 23:16select clause can also use arithmetic
  587. 23:19basic arithmetic operations for example
  588. 23:22here we are showing ah
  589. 23:24a select where the third attribute as
  590. 23:26you can see
  591. 23:28the third attribute is salary by 12
  592. 23:31assuming that the instructor table has a
  593. 23:33salary number which is annual salary by
  594. 23:3512 naturally give you the monthly salary
  595. 23:38so those
  596. 23:40such
  597. 23:42arithmetic choices can also be made
  598. 23:46you can also rename that
  599. 23:48field that particular salary by 12 field
  600. 23:52in ah salary by 12 field by a new name
  601. 23:55as i said as can be used to rename
  602. 23:58so if we ah if you use that then
  603. 24:02when you get the output you will get the
  604. 24:05column names id name and monthly salary
  605. 24:09and in monthly salary you will actually
  606. 24:11have a computation which is salary by 12
  607. 24:14and in the same way you can use multiple
  608. 24:18different kinds of arithmetic operators
  609. 24:21now we come to the where clause where
  610. 24:23clause specifies the condition is a
  611. 24:25predicate which corresponds to the
  612. 24:28selection predicate of
  613. 24:29relational algebra so it will specify
  614. 24:32some condition here is an example if we
  615. 24:34want to find all instructors ah from the
  616. 24:37instructor table
  617. 24:39who are associated with computer science
  618. 24:42department then you can say select name
  619. 24:45from instructor
  620. 24:46and
  621. 24:47to specify that they are from the
  622. 24:50they are from
  623. 24:51the computer science
  624. 24:54department you will specify department
  625. 24:57name is equal to computer science so
  626. 25:00this will ensure that
  627. 25:02you select the records only when this
  628. 25:04condition is satisfied so all records
  629. 25:07for which department name is different
  630. 25:09from computer science will not be
  631. 25:11included
  632. 25:12here
  633. 25:15ok
  634. 25:20you can also write predicates using the
  635. 25:23different logical connectives and or not
  636. 25:26and so on so here is an example where
  637. 25:30you are finding all instructors in
  638. 25:31computer science with salary greater
  639. 25:33than eighty thousand
  640. 25:35so here we have used and clause so only
  641. 25:38records where the department name is
  642. 25:39computer science and salary is greater
  643. 25:41than 80 000 will be
  644. 25:44chosen in the result
  645. 25:46so and then the projection will be done
  646. 25:49on the name of those instructors
  647. 25:53you can apply
  648. 25:55comparisons ah of arithmetic expression
  649. 25:57so where clause can really write
  650. 25:59different kind of things
  651. 26:06finally the from clause is
  652. 26:08sets all the different
  653. 26:10relations from where you are actually
  654. 26:13looking for the records
  655. 26:15so it kind of corresponds to the
  656. 26:17cartesian product of the relational
  657. 26:20algebra
  658. 26:21so if we
  659. 26:23ah want to say
  660. 26:25compute
  661. 26:26instructor cartesian product teaches
  662. 26:29then you can say select star
  663. 26:32instructor
  664. 26:34one table comma teaches
  665. 26:36so this will choose
  666. 26:40records from instructor relation as well
  667. 26:43as from teachers relation and in all
  668. 26:46possible combined way
  669. 26:47it will put them in the output we have
  670. 26:50used a star so all fields of instructor
  671. 26:52and all fields of teachers will be there
  672. 26:55in the output
  673. 26:57and since
  674. 26:58some fields may have identical name like
  675. 27:01id
  676. 27:02there is an id in instructor and there
  677. 27:03is id in teachers
  678. 27:05they will be qualified by the name of
  679. 27:07the relation
  680. 27:11from can ah have one relation two
  681. 27:14relation any number of relations as you
  682. 27:16require
  683. 27:20so this will cause the cartesian product
  684. 27:22to be computed which may not be very
  685. 27:24useful ah
  686. 27:25as
  687. 27:26an independent feature but we will see
  688. 27:30in the next module how it can give very
  689. 27:32important computations ah in terms of
  690. 27:35computing joints and so on
  691. 27:37so here is an example ah of the
  692. 27:40cartesian product that we talked of so
  693. 27:42here is the instructor relation the
  694. 27:44teachers relation
  695. 27:46and as you can see when we have
  696. 27:48done this ah
  697. 27:50cartesian product that is select star
  698. 27:52from instructor comma teaches
  699. 27:55then all fields this is a
  700. 27:58id
  701. 27:59of the instructor it has
  702. 28:01there is an id in teaches so that is
  703. 28:04also specified here qualified by the
  704. 28:07name of the relation
  705. 28:09whereas name
  706. 28:10comes in directly because there is no
  707. 28:12nothing no attribute called name in
  708. 28:14teaches
  709. 28:15the department name comes in directly
  710. 28:17salary comes in directly course id comes
  711. 28:20in section id comes in semester comes in
  712. 28:23year comes in and so on
  713. 28:25and the combination of
  714. 28:28all tuples in the
  715. 28:31instructor
  716. 28:32relation against all tuples of the
  717. 28:35teachers relation
  718. 28:36all possible combinations have come in
  719. 28:39in this result
  720. 28:40which eventually is a cartesian product
  721. 28:44of the relational algebra
  722. 28:46so
  723. 28:48this is uh
  724. 28:50what we have
  725. 28:52to summarize we have introduced the
  726. 28:55relational query language
  727. 28:57and particularly familiarized ourselves
  728. 29:00with the data definition that is
  729. 29:02creation of the table creation of the
  730. 29:04schema
  731. 29:06with the attribute names domain types
  732. 29:08and constraints
  733. 29:09and
  734. 29:10the updates to the table in terms of
  735. 29:14insertion and deletion of values or
  736. 29:16addition or deletion of attributes or
  737. 29:20removing a table altogether and
  738. 29:23then we have
  739. 29:24given the basic structure of the select
  740. 29:27from where query of sql
  741. 29:30which will be the key
  742. 29:32language feature of a query language
  743. 29:35that we will continue to discuss all
  744. 29:37through this course

About this transcript

This page contains the full transcript of Introduction to SQL/1 by Data Base Management System - IITKGP, generated from the public captions YouTube serves with the video. The transcript has 3,787 words across 744 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.