Computer Science, asked by jasmeen7768, 10 months ago

39. (a) Write a Query to create a Table with the following structure

Table Product



Field Datatype

PID Char(4)

Pname Varchar(20)

Description Varchar(40)

Price Decimal

(b) Consider the following Vendor table and write the queries

Table Vendor

VendorID VName DateofRegistration Location

V001 Mother Dairy 20-01-2009 Delhi

V002 Havmor 01-04-2015 Gujrat

V003 Amul 12-05-2012 Kolkata

V004 Kwality Walls 15-10-2013 Mumbai

(2+3)

(i) Write a Query to display all records

(ii) Write a Query to add a new row with the following details

(‘V005’, ‘Vadilal’, ‘2010-03-20’, ‘Pune’)

(iii) Write a query to modify the location of V003 from Kolkata to Gujrat​

Answers

Answered by Anonymous
25

\huge{\underline{\underline{\red{\mathfrak{Question:}}}}}

</p><p>&lt;style type="text/css"&gt;</p><p>.table th{ font-size: 12px;</p><p>text-align: center;}</p><p>.table td{ font-size: 10px;</p><p>text-align: center;</p><p>padding: 12px 10px;</p><p>font-family: Times New Roman;}</p><p>&lt;/style&gt;</p><p>&lt;body&gt;</p><p>&lt;table class="table" border="1px" cellspacing="0px"&gt;</p><p>&lt;tr&gt;&lt;th&gt;  Table Product &lt;/th&gt;</p><p>&lt;th&gt; Field Datatype&lt;/th&gt;&lt;/tr&gt;</p><p></p><p>&lt;tr&gt;&lt;td&gt;   PID&lt;/td&gt;</p><p>&lt;td&gt;Char(4)  &lt;/td&gt;&lt;/tr&gt;</p><p></p><p>&lt;tr&gt;&lt;td&gt; Pname  &lt;/td&gt;</p><p>&lt;td&gt;  Varchar(20)&lt;/td&gt;&lt;/tr&gt;</p><p></p><p>&lt;tr&gt;&lt;td&gt;  Description &lt;/td&gt;</p><p>&lt;td&gt; Varchar(40)&lt;/td&gt;&lt;/tr&gt;</p><p></p><p>&lt;tr&gt;&lt;td&gt;  Price &lt;/td&gt;</p><p>&lt;td&gt; Decimal&lt;/td&gt;&lt;/tr&gt;</p><p>&lt;/table&gt;</p><p>&lt;body&gt;</p><p>

\huge{\underline{\underline{\green{\mathfrak{Answer:}}}}}

(a)

CREATE TABLE Product(

PID Char(4),

Pname Varchar(20),

Description Varchar(40),

Price Decimal

) ;

(b)

</p><p>&lt;style type="text/css"&gt;</p><p>.table th{ font-size: 12px;</p><p>text-align: center;}</p><p>.table td{ font-size: 10px;</p><p>text-align: center;</p><p>padding: 12px 10px;</p><p>font-family: Times New Roman;}</p><p>&lt;/style&gt;</p><p>&lt;body&gt;</p><p>&lt;table class="table" border="1px" cellspacing="0px"&gt;</p><p>&lt;tr&gt;&lt;th&gt;  VendorID &lt;/th&gt;</p><p>&lt;th&gt;  VName &lt;/th&gt;</p><p>&lt;th&gt;  Date of Registration&lt;/th&gt;</p><p>&lt;th&gt; Location&lt;/th&gt;&lt;/tr&gt;</p><p></p><p>&lt;tr&gt;&lt;td&gt;   V001&lt;/td&gt;</p><p>&lt;td&gt;  Mother Diary&lt;/td&gt;</p><p>&lt;td&gt;  20-01-2009 &lt;/td&gt;</p><p>&lt;td&gt;Delhi &lt;/td&gt;&lt;/tr&gt;</p><p></p><p>&lt;tr&gt;&lt;td&gt;  V002&lt;/td&gt;</p><p>&lt;td&gt;  Havmor &lt;/td&gt;</p><p>&lt;td&gt;  01-04-2015 &lt;/td&gt;</p><p>&lt;td&gt; Gujurat &lt;/td&gt;&lt;/tr&gt;</p><p></p><p>&lt;tr&gt;&lt;td&gt;  V003&lt;/td&gt;</p><p>&lt;td&gt;   Amul&lt;/td&gt;</p><p>&lt;td&gt;  12-05_2012 &lt;/td&gt;</p><p>&lt;td&gt; Kolkata&lt;/td&gt;&lt;/tr&gt;</p><p></p><p>&lt;tr&gt;&lt;td&gt;  V004&lt;/td&gt;</p><p>&lt;td&gt;  Kwality Walls&lt;/td&gt;</p><p>&lt;td&gt;  15-10-2013 &lt;/td&gt;</p><p>&lt;td&gt; Mumbai&lt;/td&gt;&lt;/tr&gt;</p><p>&lt;/table&gt;</p><p>&lt;body&gt;</p><p>

(i) SELECT * FROM Vendor;

(ii) INSERT INTO Vendor("VendorID", "VName, "Date of Registration", 'Location") VALUES

(‘V005’, ‘Vadilal’, ‘2010-03-20’, ‘Pune’);

(iii) UPDATE Vendor Location = " Gujurat" WHERE V003 ="Kolkata ";

Similar questions