• Q & A – Python Numbers

    Q & A – Python Numbers

    (1) Check If A Number Is Positive, Negative or 0. num = float(input(‘Enter A Number ‘)) if num > 0: print(‘Positive Number’) elif num < 0: print(‘Negative Number’) else: print(‘Zero’) (2) Check If A Number Is Odd or Even. num = float(input(‘Enter A Number’)) if num % 2 == 0: print(‘Even Number’) else: print(‘Odd Number’) (3) Check A Year Is Leap Year Or Not. We have discussed above, we know that because the Earth rotates about 365.242375 times a year but a normal year is 365 days, something has to be done to “catch up” the extra 0.242375 days a

    Read More

  • Q & A – Python String

    Q & A – Python String

    (1) What Is A String Datatype? A String is a collection of a sequence of characters. A String can contain Alphabetic, Numeric, or Special characters. A String variable is enclosed within a single(”) or double quote(“”). A String type in Python is of the ‘str’ type. Example-1 name = 'Subrat Kumar Sahoo' print(name) Subrat Kumar Sahoo Example-2 password = "hallo@123" print(password) hallo@123 Example-3 country = 'India' print(country) India (2) How To Check Existence Of A Character Or A Sub-string In A String? You can use ‘in’ keyword to check the existence of a sub-string in a string. Example-1 "pass" in

    Read More

  • SQL – How To Alter SQL Table?

    SQL – How To Alter SQL Table?

    SQL – How To Alter SQL Table? Table Of Contents: What Is Altering A Table? Syntax Of Altering A Table. Examples Of Altering A Table. (1) What Is Altering A Table? The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. The ALTER TABLE statement is also used to add and drop various constraints on an existing table. (2) Syntax Of Altering A Table? Adding A Column: ALTER TABLE table_name ADD column_name datatype; Dropping A Column: ALTER TABLE table_name DROP COLUMN column_name; Renaming A Column: ALTER TABLE table_name RENAME COLUMN old_name to new_name; Modifying Datatype Of A Column:

    Read More

  • SQL – How To Drop SQL Table?

    SQL – How To Drop SQL Table?

    SQL – How To Drop SQL Table? Table Of Content: What Is Dropping A Table? Syntax Of Dropping SQL Table. Examples Of Dropping SQL Table. (1) What Is Dropping A Table? Dropping a table means, deleting the entire table from the database. Be careful before dropping a table. Deleting a table will result in the loss of complete information stored in the table! (2) Syntax Of Dropping SQL Table. DROP TABLE table_name; (3) Examples Of Dropping SQL Table. DROP TABLE Shippers;

    Read More

  • SQL – How To Create A Table?

    SQL – How To Create A Table?

    SQL – How To Create A Table? Table Of Contents: Syntax Of Creating A Table. Examples Of Creating A Table. (1) Syntax Of Creating A Table CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, …. ); (2) Examples Of Creating A Table Example-1: Creating A New Table CREATE TABLE Persons ( PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) ); Example-2: Create Table Using Another Table CREATE TABLE TestTable AS SELECT customername, contactname FROM customers;

    Read More

  • SQL – How To Backup A DataBase?

    SQL – How To Backup A DataBase?

    SQL – How To Backup A DataBase? Table Of Content: Syntax Of Database Backup. Examples Of Database Backup. (1) Syntax Of Database Backup. BACKUP DATABASE databasename TO DISK = ‘filepath’; The SQL BACKUP WITH DIFFERENTIAL Statement BACKUP DATABASE databasename TO DISK = ‘filepath’ WITH DIFFERENTIAL; (2) Examples Of Database Backup. Example-1: BACKUP DATABASE Example BACKUP DATABASE testDB TO DISK = ‘D:backupstestDB.bak’; Example-2: BACKUP WITH DIFFERENTIAL Example BACKUP DATABASE testDB TO DISK = ‘D:backupstestDB.bak’ WITH DIFFERENTIAL;

    Read More

  • SQL – How To Drop A Database?

    SQL – How To Drop A Database?

    SQL How To Drop A Database? Table Of Contents: How To Drop A Database? Examples Of Dropping A Database? (1) How To Drop A Database? Syntax: DROP DATABASE databasename; (2) Examples Of Dropping A Database? DROP DATABASE testDB;

    Read More

  • SQL – How To Create A Database?

    SQL – How To Create A Database?

    SQL – How To Create A Database? Table Of Contents: Syntax Of Creating SQL Database. Examples Of Creating Database. (1) Syntax Of Creating SQL Database. CREATE DATABASE databasename; (2) Examples Of Creating SQL Database. CREATE DATABASE testDB;

    Read More

  • SQL – Insert Into

    SQL – Insert Into

    SQL Insert Into Table Of Content: What Is SQL Insert Into Statement? Syntax Of SQL Insert Into Statement. Examples Of SQL Insert Into Statement. (1) What Is SQL Insert Into Statement? The INSERT INTO SELECT statement copies data from one table and inserts it into another table. The INSERT INTO SELECT statement requires that the data types in the source and target tables match. (2) Syntax Of SQL Insert Into Statement. Copy all columns from one table to another table: INSERT INTO table2 SELECT * FROM table1 WHERE condition; Copy only some columns from one table into another table: INSERT INTO table2 (column1,

    Read More

  • SQL – Select Into

    SQL – Select Into

    SQL Select Into Table Of Contents: What Is SQL Select Into? Syntax Of SQL Select Into. Examples Of SQL Select Into. (1) What Is SQL Select Into? The SELECT INTO statement copies data from one table into a new table. (2) Syntax Of SQL Select Into. SELECT * INTO newtable [IN externaldb] FROM oldtable WHERE condition; Copy only some columns into a new table: SELECT * INTO newtable [IN externaldb] FROM oldtable WHERE condition; Note: The new table will be created with the column names and types as defined in the old table. You can create new column names using the AS clause.

    Read More