Documente Academic
Documente Profesional
Documente Cultură
Answer:
create table Movie(id integer,title varchar(20),budget integer,hero
varchar(20),genre varchar(20));
Answer:
insert into Movie values(1,"Pollathavan",122200000,"Rajini",23);
Query OK, 1 row affected (0.07 sec)
Answer:
select title,genre,budget fromMoviewhere hero like "Rajini" or
"Kamal" ;
+-------------+-------+-----------+
| title | genre | budget |
+-------------+-------+-----------+
| Pollathavan | 23 | 122200000 |
+-------------+-------+-----------+
Answer:
update Movie set budget=120000 where id=101;
Answer:
select avg(budget) from Movie group by(hero);
+----------------+
| avg(budget) |
+----------------+
| 61160000.0000 |
| 122200000.0000 |
+----------------+
+-------------+
| min(budget) |
+-------------+
| 120000 |
| 122200000 |
+-------------+
(Or)
2.Write a perl subroutine to find the factorial of given number
Answer:
def min(l):
a=l[0]
for i in l:
if i <a:
a=i
return a
def max(l):
b=l[0]
for i in l:
if i >b:
b=i
return b
def min_max(l):
x=min(l)
y=max(l)
return x,y
min,max=min_mac([1,2,50,-2,10,5])
print(min)
print(max)
Output:
-2
50
File Handling:
1.Write a python program to copy the content of one file to another file.
(Or)
2.Write a Perl program to copy the content of one file to another file.
Answer:
my $file1 = "file1.txt";
open(FHSRC, $file1)
open(FHDES, '>>file2.txt')
while($line = <FHSRC>)
{
print FHDES $line."\n";
close(FHSRC);
close(FHDES);
OUTPUT:
file1.txt
Hai
how are you
file2.txt
Hai
how are you