Posts

How to add comment on column of table or schema in oracle

Image
How to add comment on column  of a table or schema in oracle  Syntax:   COMMENT ON  COLUMN table_name . column_name IS 'comment description'; For example,  create table student(s_id number primary key,s_name varchar(20) not null ); After this if you want to comment of s_id column which acn be done as below:     comment on column student . s_id   is  'abbreviation of student id'; You can remove comment by setting it to null as shown below:     comment on column student . s_id   is ' '; Add comment in Oracle sql

How to upload file or image in html form using php

How to upload file or image in html form using php The source code of uploading a file is given below. <?php error_reporting ( 0 ); ? > < html > < body > < form action = "" method = "post" enctype = "multipart/form-data" > < input type = "file" name = "uploadfile" value = "" > < input type = "submit" name = "submit" value = "Upload File" > </ form > </ body > </ html > <?php $folder = "student/" ; $filename = $_FILES [ "uploadfile" ][ "name" ]; $tempname = $_FILES [ "uploadfile" ][ "tmp_name" ]; $folder = "student/" . $filename ; // To save the image at folder student/image_name //echo $folder; move_uploaded_file ( $tempname , $folder ); //temp location to destination echo "<img src=' $folde...

Login page in php ,mysql using using html form (source code)

Login page in php ,mysql using using html form The  source code of login page in html using php and mysql connection is given below. <?php session_start (); include ( "connection.php" ); ? > < form acion = "" method = "POST" > Username: < input type = "text" name = "username" value = "" />< br >< br > Password: < input type = "password" name = "password" value = "" />< br >< br > < input type = "submit" name = "submit" value = "login" /> </ form > <?php if ( isset ( $_POST [ 'submit' ])) { $user = $_POST [ 'username' ]; $pwd = $_POST [ 'password' ]; $query = " SELECT * FROM STUDENT WHERE username = ' $user ' && password = ' $pwd ' " ; $data = mysqli_query ( $conn , $query );...

Database table of a tennis club in oracle(query)

 Database table of a tennis club The following is query of the database of a tennis club with different tables ,their relationships and constraints. It has following five tables:  PLAYERS TEAMS MATCHES PENALTIES COMMITTEE_MEMBERS CREATE TABLE PLAYERS (PLAYERNO NUMBER PRIMARY KEY,NAME VARCHAR(20) NOT NULL , INITIALS VARCHAR(30) NOT NULL CHECK(INITIALS NOT LIKE '% %' AND INITIALS NOT LIKE '%.%') , BIRTH_DATE DATE NOT NULL ,SEX CHAR(1) CHECK(SEX IN ('M','F')) ,JOINED DATE CHECK(JOINED>'31-DEC-1969'), STREET VARCHAR(20),HOUSENO VARCHAR(20) NOT NULL,POSTCODE NUMBER NOT NULL CHECK(LENGTH(POSTCODE)=6), TOWN VARCHAR(20) UNIQUE,PHONENO NUMBER NOT NULL CHECK(LENGTH(PHONENO)=10),LEAGUENO NUMBER UNIQUE NOT NULL); CREATE TABLE TEAMS (TEAMNO NUMBER PRIMARY KEY,PLAYERNO NUMBER ,FOREIGN KEY(PLAYERNO) REFERENCES PLAYERS(PLAYERNO),DIVISION VARCHAR(7) CHECK(DIVISION IN ('FIRST','SECOND'))); CREATE TABLE M...

Connection of database in mysql using php(source code)

Image
Connection of database  in  mysql using php Connection with the database can be  established using mysqli_connect() function which accepts four parameter as the argument viz. server name,username ,password and database name.   Server name -It can be url of the database or localhost in case of      on the same machine .   Username -It is the name of user (e.g. root) .   Password -Password associated with that user name .    Database -The name of database in which you want to insert the       data. The code for the same is given below. <?php $servername = "localhost" ; $username = "root" ; $password = "" ; $dbname = "db1" ; $conn = mysqli_connect ( $servername , $username , $password , $dbname ); if ( $conn ) { echo "connection ok" ; } else { die ( "Connnetion Failed because" . mysqli_connect_error ()); } ? > Explanation: Here $conn is a vari...

best conceptual questions in c programming

Best conceptual questions in c programming     1. void main()      {int x=1;         switch (x)           { x=x+1;              case 1 :printf("one");break;              case 2 :printf("two");break;              default:printf("three");           }       } What will be output? Answer: one 2. What  will be output of following code segment int i=1; while(i++<); printf("%d",i); Answer: 6 3. What is the output of following snippet? void main() {int a=321;  char *p; p=&a; printf("%c",*p); } Answer: A Note: The file name must be saved with .c extension. 4. What will be output of following code segment? #define   x  5+2; void main() { int i;  i=x*x*x; printf("%d",i); Answer: 27 5.What will be o...