Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • All About oracle password and security from metalink Oracle
  • DETERMINING WHICH INSTANCE OWNS WHICH SHARED MEMORY & SEMAPHORE SEGMENTS Oracle
  • Checking SQL Server Version SQL Server
  • Database link password in user_db_links Oracle
  • to see when crontab is changed. Linux/Unix
  • Updated LCK.SQL file. Oracle
  • create trigger syntax Oracle
  • Distributed Transaction Troubleshooting. Oracle
  • V$INSTANCE of Oracle in MYSQL MYSQL
  • Creating a Container Database using dbaascli Uncategorized
  • SQL Server: How to see historical transactions SQL Server
  • Optimizer SORT Operations Oracle
  • Windows based Command line mailing program like mailx (Sednmail for windows) PHP/MYSQL/Wordpress
  • sid_wise_sql.sql Oracle
  • exp syntax in oracle 10g Oracle

Getting started with notebook

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Getting started with notebook
# Databricks notebook source

 

%sql
create database if not exists abcdb

 

%sql
use abcdb

 

%sql
create table student (id int , name string)

 

%sql
insert into student
select 1 as id, ‘user1’ as name

 

%sql
select * from student

 

spark.sql(“create database if not exists xyzdb”)
spark.sql(“use xyzdb”)

 

# Use three double quotes (“””) if SQL you are using has multiple lines.
spark.sql(“”” create table student1
        ( id int,
        name string )”””)

 

spark.sql(“”” insert into student1
        select 2 as id, ‘test1’ as name””” )

 

# Different format of printing or displaying dataframe.

# Selecting rows from dataframe
spark.sql(“select * from student1”).display()
spark.sql(“select * from student1”).show()

# Storing result-set in collection
spark.sql(“select * from student1”).collect

# Describe schema and datatype
spark.sql(“select * from student1”).printSchema()

 
Python/PySpark

Post navigation

Previous Post: Read CSV file using PySpark
Next Post: Add new columns in dataframe

Related Posts

  • Reading config file from other folder inside class Python/PySpark
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Read CSV file using PySpark Python/PySpark
  • Add new columns in dataframe Python/PySpark
  • Read CSV File using Python Python/PySpark
  • Python class import from different folders Python/PySpark

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (400)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (348)
  • SQL Server (6)
  • Uncategorized (3)
  • Videos (0)

Recent Posts

  • Running PDB on single node in RAC09-Apr-2026
  • find_arc.sql09-Apr-2026
  • pvm_pre_change.sql08-Apr-2026
  • find_encr_wallet.sql08-Apr-2026
  • find_pdbs.sql08-Apr-2026
  • Creating a Container Database using dbaascli08-Apr-2026
  • track_autoupgrade_copy_progress.sql01-Apr-2026
  • refre.sql for multitenant01-Apr-2026
  • prepfiles.sh for step by step generating pending statistics files10-Mar-2026
  • tracksqltime.sql05-Mar-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Some OS level threshold for performance. Linux/Unix
  • How to stop OCSSD Daemon Oracle
  • import-export with multiple files Oracle
  • Building Our Own Namespaces with “Create Context” Oracle
  • Adding addidional hard drive and attach it to a linux box. Linux/Unix
  • find_pk.sql /* Find Primary Key */ Oracle
  • Useful Solaris Commands on 28-SEP-2005 Linux/Unix
  • SQL Server: How to see historical transactions SQL Server

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme