Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • get_ratio.sql get the ratio of users from v$session and this uses CASE-WHEN-THEN clause Oracle
  • note id 373303.1 Linux/Unix
  • grep multuple patterns Linux/Unix
  • sbind.sql Find Bind variable from sql_id sqlid Oracle
  • eplan9i.sql Oracle
  • Finding Oracle Patches with opatch Oracle
  • plan10g.sql good Oracle
  • Monitor and Trace Unix processes using truss Linux/Unix
  • SQL Server: How to see current transactions or requests SQL Server
  • create PLAN_TABLE command. Oracle
  • DBMS_PROFILER for tuning PLSQL programs. Oracle
  • tblwopk.sql /* Find Tables Without PK */ Oracle
  • Consolidated Reference List Of Notes For Migration / Upgrade Service Requests -ID 762540.1 Oracle
  • kill all processes from specific user in solaris. Linux/Unix
  • Deleting first line and lastline of a file using sed Linux/Unix

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

  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Read CSV file using PySpark Python/PySpark
  • Python class import from different folders Python/PySpark
  • Read CSV File using Python Python/PySpark
  • Reading config file from other folder inside class Python/PySpark
  • Add new columns in dataframe 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 (402)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (350)
  • SQL Server (6)
  • Uncategorized (5)
  • Videos (0)

Recent Posts

  • SAT Mathematics 10 questions and answer at the end.30-Apr-2026
  • top 10 AI news today30-Apr-2026
  • runon_allpdbs_show_conname.sh23-Apr-2026
  • runon_allcdbs_find_pdbs.sql23-Apr-2026
  • 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

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • fkwoind.sql fkwoindex.sql Oracle
  • Alter procedure auditing Oracle
  • metalink all dynamic view reference notes. Oracle
  • Oracle Standby Database Library Index from Metalink Oracle
  • Another export with Query Oracle
  • find_pdbs.sql Uncategorized
  • OEM-Commnds Oracle
  • Changing Instance Name ( No DB_NAME) Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme